Some Qs on libcouchbase Apis
Mon, 04/23/2012 - 02:39
I came up with more questions ! YAY! (sorry)
1. what does "libcouchbase_set_cookie" Api do?
I can see that it sets cookie, but all of the APIs of libcouchbase has "cookie" as parameter that we can put it in. Why is there another API doing this?
Explanation of this "cookie" thing will be very helpful thank you.
2. IO_opt ... seems like setting IO option api to me... I will look in the source folder to check but any explanation on this will be helpful aswell since I couldn't get any info on the couchbase website
1. what does "libcouchbase_set_cookie" Api do?
I can see that it sets cookie, but all of the APIs of libcouchbase has "cookie" as parameter that we can put it in. Why is there another API doing this?
You can think about "cookies" as context parameter, the libcouchbase doesn't make any assumptions about this context. There are two types of cookies in libcouchbase:
1. instance cookie. could be carried per each libcouchbase_t instance using API calls libcouchbase_set_cookie()/libcouchbase_get_cookie()
2. command cookie. this cookie you are passing when you are scheduling the operation and it will be available in the appropriate callback as cookie parameter.
E.g. when you are implementing some OOP atop of libcouchbase, the cookie could carry "this" pointer.
2. IO_opt ... seems like setting IO option api to me... I will look in the source folder to check but any explanation on this will be helpful aswell since I couldn't get any info on the couchbase website
The libcouchbase_io_opt_st instance encapsulating all IO operations the libcouchbase need to interact with cluster. This abstraction could be used when you are handing the event loop manually (not using libcouchbase_wait()) or if you are are going to add support for new evented framework. Currently libcouchbase support libevent (https://github.com/couchbase/libcouchbase/blob/master/src/plugin-libevent.c) and native windows routines (https://github.com/couchbase/libcouchbase/blob/master/src/plugin-win32.c).
Find me on FreeNode IRC in #libcouchbase channel