Couchbase C Client
3.3.13
Asynchronous C Client for Couchbase
|
These functions return status information about the handle, the current connection, and the number of nodes found within the cluster.
const char * lcb_get_node | ( | lcb_INSTANCE * | instance, |
lcb_GETNODETYPE | type, | ||
unsigned | index ) |
Return a string of host:port
for a node of the given type.
instance | the instance from which to retrieve the node |
type | the type of node to return |
index | the node number if index is out of bounds it will be wrapped around, thus there is never an invalid value for this parameter |
host:port
. If LCB_NODE_NEVERNULL was specified as an option in type
then the string constant LCB_GETNODE_UNAVAILABLE is returned. Otherwise NULL
is returned if the type is unrecognized or the LCB_NODE_CONNECTED option was specified and no connected node could be found or a memory allocation failed.type
is LCB_NODE_HTCONFIG|LCB_NODE_CONNECTED as there will always be only a single HTTP bootstrap node.Iterate over all the data nodes:
const char * lcb_get_keynode | ( | lcb_INSTANCE * | instance, |
const void * | key, | ||
size_t | nkey ) |
Get the target server for a given key.
This is a convenience function wrapping around the vBucket API which allows you to retrieve the target node (the node which will be contacted) when performing KV operations involving the key.
instance | the instance |
key | the key to use |
nkey | the length of the key |
Since this is a convenience function, error details are not contained here in favor of brevity. Use the full vBucket API for more powerful functions.
lcb_S32 lcb_get_num_replicas | ( | lcb_INSTANCE * | instance | ) |
Get the number of the replicas in the cluster.
instance | The handle to lcb |
0
if there are no replicas. lcb_S32 lcb_get_num_nodes | ( | lcb_INSTANCE * | instance | ) |
Get the number of the nodes in the cluster.
instance | The handle to lcb |
const char *const * lcb_get_server_list | ( | lcb_INSTANCE * | instance | ) |
Get a list of nodes in the cluster.
enum lcb_GETNODETYPE |
Type of node to retrieve for the lcb_get_node() function.
Enumerator | |
---|---|
LCB_NODE_HTCONFIG | Get an HTTP configuration (Rest API) node. |
LCB_NODE_DATA | Get a data (memcached) node. |
LCB_NODE_VIEWS | Get a view (CAPI) node. |
LCB_NODE_CONNECTED | Only return a node which is connected, or a node which is known to be up. |
LCB_NODE_NEVERNULL | Specifying this flag adds additional semantics which instruct the library to search additional resources to return a host, and finally, if no host can be found, return the string constant LCB_GETNODE_UNAVAILABLE. |
LCB_NODE_HTCONFIG_CONNECTED | Equivalent to |
LCB_NODE_HTCONFIG_ANY | Equivalent to When this is passed, some additional attempts may be made by the library to return any kind of host, including searching the initial list of hosts passed to the lcb_create() function. |