Couchbase C Client
2.5.6
|
Mutation Tokens are returned with mutations if LCB_CNTL_FETCH_MUTATION_TOKENS is enabled (off by default). Mutation tokens are largely of internal use, but can be used by N1QL queries and durability requirement polling
Functions | |
const lcb_MUTATION_TOKEN * | lcb_resp_get_mutation_token (int cbtype, const lcb_RESPBASE *rb) |
Retrieves the mutation token from the response structure. More... | |
const lcb_MUTATION_TOKEN * | lcb_get_mutation_token (lcb_t instance, const lcb_KEYBUF *kb, lcb_error_t *errp) |
Macros | |
#define | LCB_MUTATION_TOKEN_ID(p) |
Get the vBucket UUID. | |
#define | LCB_MUTATION_TOKEN_SEQ(p) |
Get the sequence number. | |
#define | LCB_MUTATION_TOKEN_VB(p) |
Get the vBucket number itself. | |
#define | LCB_MUTATION_TOKEN_ISVALID(p) |
Whether this mutation token has valid contents. | |
const lcb_MUTATION_TOKEN* lcb_resp_get_mutation_token | ( | int | cbtype, |
const lcb_RESPBASE * | rb | ||
) |
Retrieves the mutation token from the response structure.
cbtype | the type of callback invoked |
rb | the pointer to the response |
const lcb_MUTATION_TOKEN* lcb_get_mutation_token | ( | lcb_t | instance, |
const lcb_KEYBUF * | kb, | ||
lcb_error_t * | errp | ||
) |
Retrieves the last mutation token for a given key. This relies on the LCB_CNTL_DURABILITY_MUTATION_TOKENS option, and will check the instance-level log to determine the latest MUTATION_TOKEN for the given vBucket ID which the key maps to.
instance | the instance | |
kb | The buffer representing the key. The type of the buffer (see lcb_KEYBUF::type) may either be LCB_KV_COPY or LCB_KV_VBID | |
[out] | errp | Set to an error if this function returns NULL |
Getting the latest mutation token for a key:
Getting the latest mutation token for a vbucket:
Getting the mutation token for each vbucket
struct lcb_MUTATION_TOKEN |
Structure representing a synchronization token.
This token may be used for durability operations and N1QL queries. The contents of this structure should be considered opaque, and accessed via the various macros
Data Fields | ||
---|---|---|
lcb_U64 | uuid_ | Use LCB_MUTATION_TOKEN_ID() |
lcb_U64 | seqno_ | Use LCB_MUTATION_TOKEN_SEQ() |
lcb_U16 | vbid_ | Use LCB_MUTATION_TOKEN_VB() |