I’m using libcouchbase, have couple questions here:
lcb_datatype_t is ENUM ? what is the possible value of lcb_datatype_t? i tried to use LCB_JSON, my code cannot be compile, cannot find this type. can anyone point out the definition of lcb_datatype_t?
typedef lcb_uint8_t lcb_datatype_t doesn’t tell what kind of ENUM could be assigned to it.
I try to run lcb_store code to store new record in couchbase server get error:
Key exists (with a different CAS value)
if i remove store->v.v0.cas = 0x1234; it works.
if i change the cas value, still get error.
LCB_JSON issue as described above, i changed it to 0 or 1, but still store data in binary instead of json. please advice. thanks a lot!
lcb_datatype_t is type tag, it doesn’t force any data conversion.
The datatypes defined in this file https://github.com/couchbase/libcouchbase/blob/master/include/memcached/… they aren’t exported, because final decision about server-side implementation hasn’t been made.
The CAS value is changing after each mutation, so you should track it and pass to further mutations to implement optimistic locking. You can pick CAS either in any operation callback
thanks, avsej. what value I should assign to store->v.v0.datatype if I want to store JSON data?
how to track CAS ? any API to call or I have to store them in data structure like map and track them by myself?
thanks a lot!