c - Monitoring a couchbase bucket with libevent -
I am trying to implement a single application that writes / Modifications / New Documents occurrences are coming from a different application on a couchbase remote cluster. Now I can use couchbase csd and I am familiar with synchronous examples, but I have a problem combining the libenvent for asynchronous I / O I have read the discussion But I can not understand how I will tell my event_base, for example: Monitor this file on this bucket and send me a callback when it is modified Even what do I do: First of all, I am making my libevent IO option and after that I should make my example: And then I schedule a connection. I use the libcouchbase version 2.0.17 , Libevent Core version 2.0.so.5.1.9 and Libevent Extras Edition Use 2.0.so.5.1.9 . With the above code, my example can not be connected to the CouchBase. I get the following warnings: Ensure that both the libraries and have similar libevent versions Using the repository to install packages, you must align with the libevent version used in it (like For a complete exchange, please see the comment on this question :)
struct event_base * mEvbase = event_base_new (); Lcb_t Example; Lcb_error_t error; Struct lcb_create_io_ops_st ciops; Lcb_io_opt_t ioops; Memes (& amp; ciops, 0, size (ciops)); Ciops.v.v0.type = LCB_IO_OPS_LIBEVENT; Ciops.v.v0.cookie = MiBase; Err = lcb_create_libevent_io_opts (0, & amp; ioops, mEvbase); If (err! = LCB_SUCCESS) {ERRORMSG0 ("Failed to create IOOPS structure for libevent:% s \ n", lcb_strerror (NULL, error)); }
struct lcb_create_st create_options; Std :: string host = std :: string ("couchbase: //192.168.130.10/"); Host.append (bucket); Const char password [] = "password"; create_options.version = 3; Create_options.v.v3.connstr = host.c_str (); Create_options.v.v3.passwd = Password; Create_options.v.v3.io = ioops; // Creating an LCB example = lcb_create (& amp; Examples, & amp; create_options); If (Error! = LCB_SUCCESS) {Dead (zero, "Couchbase handler could not be created \ n", mistake); Return; } / * Assign to the caller handler for the operation type * / lcb_set_bootstrap_callback (for example, bootstrap_callback); Lcb_set_get_callback (e.g., generic_gate_backback); Lcb_set_store_callback (e.g., generic_store_callback);
// We now schedule a connection with the server = lcb_connect (example); If (err! = LCB_SUCCESS) {die (Example, "Could not schedule connection \ n", mistake); lcb_destroy (example); } Lcb_set_cookie (e.g., mEvbase);
event_pending: there is no event_base set in the event. Event_add: There is no Event_base set in the event. There are two problems here: I am unable to use the above code and I do not know which direction to go in order to get the events. If someone points me to a link or coded example of this simple matter which will unblock me.
ldd /usr/lib64/libcouchbase_libevent.so ). Keep in mind that it should be of the same ABI (for example, the libevent 2.0 -> will not use the compat layer, because there are different ABIs in the two versions, and 2.0 using a libcouchbase_libevent.so, associated with 2.0 Will break under).
Comments
Post a Comment