Couchbase C Client
2.5.2
|
Mutate an item within the cluster.
Here you can create a new item, replace an existing item, and append or prepend to an existing value
Functions | |
lcb_store_callback | lcb_set_store_callback (lcb_t, lcb_store_callback callback) |
Set the callback to be received when an item has been stored. More... | |
lcb_error_t | lcb_store (lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_store_cmd_t *const *commands) |
Store an item in the cluster. More... | |
Typedefs | |
typedef void(* | lcb_store_callback) (lcb_t instance, const void *cookie, lcb_storage_t operation, lcb_error_t error, const lcb_store_resp_t *resp) |
The callback function for a storage request. More... | |
Enumerations | |
enum | lcb_storage_t |
operation parameter for lcb_store() More... | |
lcb_store_callback lcb_set_store_callback | ( | lcb_t | , |
lcb_store_callback | callback | ||
) |
Set the callback to be received when an item has been stored.
callback | the new callback to install, or NULL to just query the current callback |
lcb_error_t lcb_store | ( | lcb_t | instance, |
const void * | command_cookie, | ||
lcb_SIZE | num, | ||
const lcb_store_cmd_t *const * | commands | ||
) |
Store an item in the cluster.
You may initialize all of the members in the the lcb_item_st structure with the values you want. Values larger than 30*24*60*60
seconds (30 days) are interpreted as absolute times (from the epoch). Unused members should be set to zero.
instance | the instance used to batch the requests from |
command_cookie | A cookie passed to all of the notifications from this command |
num | the total number of elements in the commands array |
commands | the array containing the items to store |
Operation-specific error codes include:
struct lcb_STORECMDv0 |
lcb_store() Command structure
This structure is used to define an item to be stored on the server.
Data Fields | ||
---|---|---|
const void * | key | |
lcb_SIZE | nkey | |
const void * | bytes | Value to store. |
lcb_SIZE | nbytes | Length of value to store. |
lcb_U32 | flags | User-defined flags stored along with the item. |
lcb_cas_t | cas |
If present, the server will check that the item's current CAS matches the value specified here. If this check fails the command will fail with an LCB_KEY_EEXISTS error.
|
lcb_U8 | datatype | See lcb_VALUEFLAGS. |
lcb_time_t | exptime |
Expiration for the item.
|
lcb_storage_t | operation |
Mandatory. Mutation type |
struct lcb_store_cmd_t |
Wrapper structure for lcb_STORECMDv0.
Data Fields | ||
---|---|---|
int | version | |
union lcb_store_cmd_t | v |
struct lcb_store_resp_t |
Wrapper structure for lcb_STORERESPv0.
Data Fields | ||
---|---|---|
int | version | |
union lcb_store_resp_t | v |
typedef void(* lcb_store_callback) (lcb_t instance, const void *cookie, lcb_storage_t operation, lcb_error_t error, const lcb_store_resp_t *resp) |
The callback function for a storage request.
instance | the instance performing the operation |
operation | the operation performed |
cookie | the cookie associated with with the command |
error | The status of the operation |
resp | More information about the item related to the store operation. (only key and nkey is valid if error != LCB_SUCCESS) |
enum lcb_storage_t |
operation
parameter for lcb_store()
Storing an item in couchbase is only one operation with a different set of attributes / constraints.