Couchbase C Client
2.5.6
|
Retrieve a document from a replica if it cannot be fetched from the primary.
Functions | |
lcb_error_t | lcb_rget3 (lcb_t instance, const void *cookie, const lcb_CMDGETREPLICA *cmd) |
Spool a single get-with-replica request. More... | |
Enumerations | |
enum | lcb_replica_t |
Select get-replica mode. More... | |
lcb_error_t lcb_rget3 | ( | lcb_t | instance, |
const void * | cookie, | ||
const lcb_CMDGETREPLICA * | cmd | ||
) |
Spool a single get-with-replica request.
instance | |
cookie | |
cmd |
When a response is received, the callback installed for LCB_CALLBACK_GETREPLICA will be invoked. The response will be an lcb_RESPGET pointer.
### Request
### Response
struct lcb_CMDGETREPLICA |
Command for requesting an item from a replica.
options.exptime
and options.cas
fields are ignored for this command.This structure is similar to lcb_RESPGET with the addition of an index
and strategy
field which allow you to control and select how many replicas are queried.
Data 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_replica_t | strategy |
Strategy for selecting a replica. The default is LCB_REPLICA_FIRST which results in the client trying each replica in sequence until a successful reply is found, and returned in the callback. LCB_REPLICA_FIRST evaluates to 0. Other options include:
|
int | index |
Valid only when strategy is LCB_REPLICA_SELECT, specifies the replica index number to query. This should be no more than |
enum lcb_replica_t |
Select get-replica mode.