Couchbase C Client  2.10.7
Asynchronous C Client for Couchbase
Miscellaneous Commands

Detailed Description

Additional miscellaneous commands which can be executed on the server.

Server Statistics

typedef lcb_CMDBASE lcb_CMDSTATS
 Command structure for stats request The lcb_CMDSTATS::key field should contain the statistics key, or be empty if the default statistics are desired. More...
 
lcb_error_t lcb_stats3 (lcb_t instance, const void *cookie, const lcb_CMDSTATS *cmd)
 Schedule a request for statistics from the cluster. More...
 
#define LCB_CMDSTATS_F_KV
 The key is a stored item for which statistics should be retrieved. More...
 

Server Versions

Warning
This does not return the actual Couchbase version but rather the internal version of the memcached server.
lcb_error_t lcb_server_versions3 (lcb_t instance, const void *cookie, const lcb_CMDBASE *cmd)
 

Server Log Verbosity

enum  lcb_verbosity_level_t
 level field for lcb_server_verbosity3 ()
 
typedef lcb_RESPSERVERBASE lcb_RESPVERBOSITY
 
lcb_error_t lcb_server_verbosity3 (lcb_t instance, const void *cookie, const lcb_CMDVERBOSITY *cmd)
 

Function Documentation

◆ lcb_stats3()

lcb_error_t lcb_stats3 ( lcb_t  instance,
const void *  cookie,
const lcb_CMDSTATS cmd 
)

Schedule a request for statistics from the cluster.

Stability
Committed:
Parameters
instancethe instance
cookiepointer to associate with the request
cmdthe command
Returns
LCB_SUCCESS on success, other error code on failure.

Note that the callback for this command is invoked an indeterminate amount of times. The callback is invoked once for each statistic for each server. When all the servers have responded with their statistics, a final callback is delivered to the application with the LCB_RESP_F_FINAL flag set in the lcb_RESPSTATS::rflags field. When this response is received no more callbacks for this command shall be invoked.

Request
lcb_CMDSTATS cmd = { 0 };
// Using default stats, no further initialization
lcb_stats3(instance, fp, &cmd);
lcb_wait(instance);
Response
lcb_install_callback3(instance, LCB_CALLBACK_STATS, stats_callback);
void stats_callback(lcb_t, int, const lcb_RESPBASE *rb)
{
const lcb_RESPSTATS *resp = (const lcb_RESPSTATS*)rb;
if (resp->key) {
printf("Server %s: %.*s = %.*s\n", resp->server,
(int)resp->nkey, resp->key,
(int)resp->nvalue, resp->value);
}
if (resp->rflags & LCB_RESP_F_FINAL) {
printf("No more replies remaining!\n");
}
}

◆ lcb_server_versions3()

lcb_error_t lcb_server_versions3 ( lcb_t  instance,
const void *  cookie,
const lcb_CMDBASE cmd 
)
Stability
Volatile:

◆ lcb_server_verbosity3()

lcb_error_t lcb_server_verbosity3 ( lcb_t  instance,
const void *  cookie,
const lcb_CMDVERBOSITY *  cmd 
)
Stability
Volatile:

Data Structure Documentation

◆ lcb_RESPSTATS

struct lcb_RESPSTATS

Response structure for cluster statistics.

The lcb_RESPSTATS::key field contains the statistic name (not the same as was passed in lcb_CMDSTATS::key which is the name of the statistical group).

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

const char * server String containing the host:port of the server which sent this response.
const char * value The value, if any, for the given statistic.
lcb_SIZE nvalue Length of value.

◆ lcb_RESPMCVERSION

struct lcb_RESPMCVERSION

Response structure for the version command.

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

const char * server String containing the host:port of the server which sent this response.
const char * mcversion The version string.
lcb_SIZE nversion Length of the version string.

Macro Definition Documentation

◆ LCB_CMDSTATS_F_KV

#define LCB_CMDSTATS_F_KV

The key is a stored item for which statistics should be retrieved.

This invokes the 'keystats' semantics. Note that when using keystats, a key must be present, and must not have any spaces in it.

Typedef Documentation

◆ lcb_CMDSTATS

Command structure for stats request The lcb_CMDSTATS::key field should contain the statistics key, or be empty if the default statistics are desired.

The #cmdflags field may contain the LCB_CMDSTATS_F_KV flag.

lcb_wait
lcb_error_t lcb_wait(lcb_t instance)
Wait for the execution of all batched requests.
lcb_RESPSTATS::nvalue
lcb_SIZE nvalue
Length of value.
Definition: couchbase.h:2250
lcb_RESPSTATS
Response structure for cluster statistics.
Definition: couchbase.h:2246
lcb_RESPSTATS::nkey
lcb_SIZE nkey
Size of key.
Definition: couchbase.h:2247
lcb_RESPSTATS::server
const char * server
String containing the host:port of the server which sent this response.
Definition: couchbase.h:2248
lcb_t
struct lcb_st * lcb_t
Definition: couchbase.h:41
lcb_RESPSTATS::value
const char * value
The value, if any, for the given statistic.
Definition: couchbase.h:2249
lcb_RESPSTATS::key
const void * key
Key for request.
Definition: couchbase.h:2247
lcb_stats3
lcb_error_t lcb_stats3(lcb_t instance, const void *cookie, const lcb_CMDSTATS *cmd)
Schedule a request for statistics from the cluster.
lcb_RESPBASE
Base response structure for callbacks.
Definition: couchbase.h:625
lcb_CMDBASE
Common ABI header for all commands.
Definition: couchbase.h:522
lcb_RESPSTATS::rflags
lcb_U16 rflags
Response specific flags.
Definition: couchbase.h:2247
LCB_CALLBACK_STATS
@ LCB_CALLBACK_STATS
lcb_stats3()
Definition: couchbase.h:703
LCB_RESP_F_FINAL
@ LCB_RESP_F_FINAL
No more responses are to be received for this request.
Definition: couchbase.h:658
lcb_install_callback3
lcb_RESPCALLBACK lcb_install_callback3(lcb_t instance, int cbtype, lcb_RESPCALLBACK cb)