I came up with more questions ! YAY! (sorry)
- 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.
- 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
In libcouchbase there are two forms of cookies, one is the ‘user context’ for the operation, (and gets passed to you in the callback) and one is the ‘user context’ for the actual libcouchbase_t handle. (Not to confuse, but there is yet a third cookie associated specifically with the iops structure 🙂 ).
the ‘cookie’ in libcouchbase is similar to this idiom you’d find:
in some other libraries.
Because the context and the lifetime of a single operation can span multiple callbacks, and because you will typically need to store the result of the operation (status code, and actual value) somewhere, the cookie argument is specifically helpful (if not downright necessary)
You can poke around the libcouchbase test suite and see how it is used there in simple contexts.