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?
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/
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?
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.
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