Couchbase C Client
2.5.6
|
Manipulate the numeric content of a document.
Counter operations treat the document being accessed as a numeric value (the document should contain a parseable integer as its content). This value may then be incremented or decremented.
Functions | |
lcb_error_t | lcb_counter3 (lcb_t instance, const void *cookie, const lcb_CMDCOUNTER *cmd) |
Schedule single counter operation. More... | |
lcb_error_t lcb_counter3 | ( | lcb_t | instance, |
const void * | cookie, | ||
const lcb_CMDCOUNTER * | cmd | ||
) |
Schedule single counter operation.
instance | the instance |
cookie | the pointer to associate with the request |
cmd | the command to use |
struct lcb_CMDCOUNTER |
Command for counter operations.
exptime
otherwise will cause the operation to fail with LCB_OPTIONS_CONFLICTData Fields | ||
---|---|---|
lcb_U32 | cmdflags |
Common flags for the command. These modify the command itself. Currently the lower 16 bits of this field are reserved, and the higher 16 bits are used for individual commands. |
lcb_U32 | exptime |
Specify the expiration time. This is either an absolute Unix time stamp or a relative offset from now, in seconds. If the value of this number is greater than the value of thirty days in seconds, then it is a Unix timestamp. This field is used in mutation operations (lcb_store3()) to indicate the lifetime of the item. It is used in lcb_get3() with the lcb_CMDGET::lock option to indicate the lock expiration itself. |
lcb_U64 | cas |
The known CAS of the item. This is passed to mutation to commands to ensure the item is only changed if the server-side CAS value matches the one specified here. For other operations (such as lcb_CMDENDURE) this is used to ensure that the item has been persisted/replicated to a number of servers with the value specified here. |
lcb_KEYBUF | key |
The key for the document itself. This should be set via LCB_CMD_SET_KEY() |
lcb_KEYBUF | _hashkey |
|
lcb_int64_t | delta |
Delta value. If this number is negative the item on the server is decremented. If this number is positive then the item on the server is incremented |
lcb_U64 | initial |
If the item does not exist on the server (and create is true) then this will be the initial value for the item. |
int | create |
Boolean value. Create the item and set it to |
struct lcb_RESPCOUNTER |
Response structure for counter operations.
Data Fields | ||
---|---|---|
void * | cookie |
Application-defined pointer passed as the cookie parameter when scheduling the command. |
const void * | key | Key for request. |
lcb_SIZE | nkey | Size of key. |
lcb_CAS | cas | CAS for response (if applicable) |
lcb_error_t | rc | Status code. |
lcb_U16 | version | ABI version for response. |
lcb_U16 | rflags |
Response specific flags. see lcb_RESPFLAGS |
lcb_U64 | value | Contains the current value after the operation was performed. |