Couchbase C Client  2.9.4
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)
 
More...
 

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.