Is it possible to register the Aerospike FDs in my event polling mechanism?


#1

I have implemented my own event handling mechanism so that I have a thread running already. I just want to register the Aerospike FDs in my event loop. Is it possible to do so ? or will it spawn a new thread?


#2

Unfortunately this question is not clear. Libevent2 linterfaces refers to event_bases and callbacks. An example API of an Aerospike get() call is the following:

int
ev2citrusleaf_get_all(ev2citrusleaf_cluster *cl, char *ns, char *set, ev2citrusleaf_object *key,
        int timeout_ms, ev2citrusleaf_callback cb, void *udata, struct event_base *base);

Additional information on Aerospike libevent can be found: http://www.aerospike.com/docs/client/libevent/


#3

Hi wchu,

Thanks for the reply. I have my own event management system implemented using epoll. I want the aerospike data base calls too to be asynchronous. So, if I have the access to the Aerospike FDs I will register them in my event loop and perform operations. Using the citrusleaf library which internally uses libevent would mean creating another thread in my application. Is it possible to do so?

Thanks Shubhada.


#4

Hi Shubhada,

The fd’s are not exposed outside the Aerospike library. They are internally created and managed, and very tightly coupled to the library implementation (wire protocol parsing etc). The design of the libevent client is to use it via the event callbacks for the put/get operations, not at the fd level.

Thanks.


#5

Hi Shubhada,

I would suggest you implement libevent2 calls proxied to your own management system. It is not so hard and not all functions need to be implemented, only used by client library. I can share the libevent2 -> boost::asio proxy, if you interesting in this.

Best regards, Max