Couchbase C Client
3.3.15
Asynchronous C Client for Couchbase
|
Various utility functions. More...
Go to the source code of this file.
Macros | |
#define | LCB_CONFIG_MCD_PORT |
#define | LCB_CONFIG_MCD_SSL_PORT |
#define | LCB_CONFIG_HTTP_PORT |
#define | LCB_CONFIG_HTTP_SSL_PORT |
#define | LCB_CONFIG_MCCOMPAT_PORT |
#define | LCB_CMD_SET_KEY(cmd, keybuf, keylen) |
Set the key for the command. | |
#define | LCB_GETNODE_UNAVAILABLE |
String constant returned by lcb_get_node() when the LCB_NODE_NEVERNULL flag is specified, and no node can be returned. | |
Typedefs | |
typedef enum lcb_timeunit_t | lcb_timeunit_t |
typedef void(* | lcb_timings_callback) (lcb_INSTANCE *instance, const void *cookie, lcb_timeunit_t timeunit, lcb_U32 min, lcb_U32 max, lcb_U32 total, lcb_U32 maxtotal) |
The following function is called for each bucket in the timings histogram when you call lcb_get_timings. | |
typedef struct lcb_histogram_st | lcb_HISTOGRAM |
typedef void(* | lcb_HISTOGRAM_CALLBACK) (const void *cookie, lcb_timeunit_t timeunit, lcb_U32 min, lcb_U32 max, lcb_U32 total, lcb_U32 maxtotal) |
typedef struct lcb_RESPGETMANIFEST_ | lcb_RESPGETMANIFEST |
typedef struct lcb_CMDGETMANIFEST_ | lcb_CMDGETMANIFEST |
typedef struct lcb_RESPGETCID_ | lcb_RESPGETCID |
typedef struct lcb_CMDGETCID_ | lcb_CMDGETCID |
Enumerations | |
enum | lcb_timeunit_t |
Time units reported by lcb_get_timings() More... | |
enum | lcb_DUMPFLAGS |
enum | lcb_GETNODETYPE |
Type of node to retrieve for the lcb_get_node() function. More... | |
Functions | |
lcb_STATUS | lcb_cbflush3 (lcb_INSTANCE *instance, void *cookie, const lcb_CMDCBFLUSH *cmd) |
lcb_STATUS | lcb_enable_timings (lcb_INSTANCE *instance) |
Start recording timing metrics for the different operations. | |
lcb_STATUS | lcb_disable_timings (lcb_INSTANCE *instance) |
Stop recording (and release all resources from previous measurements) timing metrics. | |
lcb_STATUS | lcb_get_timings (lcb_INSTANCE *instance, const void *cookie, lcb_timings_callback callback) |
Get the timings histogram. | |
void | lcb_dump (lcb_INSTANCE *instance, FILE *fp, lcb_U32 flags) |
Write a textual dump to a file. | |
lcb_HISTOGRAM * | lcb_histogram_create (void) |
void | lcb_histogram_destroy (lcb_HISTOGRAM *hg) |
void | lcb_histogram_record (lcb_HISTOGRAM *hg, lcb_U64 duration) |
void | lcb_histogram_read (const lcb_HISTOGRAM *hg, const void *cookie, lcb_HISTOGRAM_CALLBACK cb) |
void | lcb_histogram_print (lcb_HISTOGRAM *hg, FILE *stream) |
Print the histogram to the specified FILE. | |
lcb_STATUS | lcb_respgetmanifest_status (const lcb_RESPGETMANIFEST *resp) |
lcb_STATUS | lcb_respgetmanifest_cookie (const lcb_RESPGETMANIFEST *resp, void **cookie) |
lcb_STATUS | lcb_respgetmanifest_value (const lcb_RESPGETMANIFEST *resp, const char **json, size_t *json_len) |
lcb_STATUS | lcb_cmdgetmanifest_create (lcb_CMDGETMANIFEST **cmd) |
lcb_STATUS | lcb_cmdgetmanifest_destroy (lcb_CMDGETMANIFEST *cmd) |
lcb_STATUS | lcb_cmdgetmanifest_timeout (lcb_CMDGETMANIFEST *cmd, uint32_t timeout) |
lcb_STATUS | lcb_getmanifest (lcb_INSTANCE *instance, void *cookie, const lcb_CMDGETMANIFEST *cmd) |
lcb_STATUS | lcb_respgetcid_status (const lcb_RESPGETCID *resp) |
lcb_STATUS | lcb_respgetcid_cookie (const lcb_RESPGETCID *resp, void **cookie) |
lcb_STATUS | lcb_respgetcid_manifest_id (const lcb_RESPGETCID *resp, uint64_t *id) |
lcb_STATUS | lcb_respgetcid_collection_id (const lcb_RESPGETCID *resp, uint32_t *id) |
lcb_STATUS | lcb_respgetcid_scoped_collection (const lcb_RESPGETCID *resp, const char **name, size_t *name_len) |
lcb_STATUS | lcb_cmdgetcid_create (lcb_CMDGETCID **cmd) |
lcb_STATUS | lcb_cmdgetcid_destroy (lcb_CMDGETCID *cmd) |
lcb_STATUS | lcb_cmdgetcid_scope (lcb_CMDGETCID *cmd, const char *scope, size_t scope_len) |
lcb_STATUS | lcb_cmdgetcid_collection (lcb_CMDGETCID *cmd, const char *collection, size_t collection_len) |
lcb_STATUS | lcb_cmdgetcid_timeout (lcb_CMDGETCID *cmd, uint32_t timeout) |
lcb_STATUS | lcb_getcid (lcb_INSTANCE *instance, void *cookie, const lcb_CMDGETCID *cmd) |
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. | |
const char * | lcb_get_keynode (lcb_INSTANCE *instance, const void *key, size_t nkey) |
Get the target server for a given key. | |
lcb_S32 | lcb_get_num_replicas (lcb_INSTANCE *instance) |
Get the number of the replicas in the cluster. | |
lcb_S32 | lcb_get_num_nodes (lcb_INSTANCE *instance) |
Get the number of the nodes in the cluster. | |
const char *const * | lcb_get_server_list (lcb_INSTANCE *instance) |
Get a list of nodes in the cluster. | |
void * | lcb_mem_alloc (lcb_SIZE size) |
Functions to allocate and free memory related to libcouchbase. | |
void | lcb_mem_free (void *ptr) |
Use this to free memory allocated with lcb_mem_alloc. | |
LCB_INTERNAL_API void | lcb_run_loop (lcb_INSTANCE *instance) |
LCB_INTERNAL_API void | lcb_stop_loop (lcb_INSTANCE *instance) |
LCB_INTERNAL_API lcb_U64 | lcb_nstime (void) |
#define LCB_CMD_SET_KEY | ( | cmd, | |
keybuf, | |||
keylen ) |
Set the key for the command.
cmd | A command derived from lcb_CMDBASE |
keybuf | the buffer for the key |
keylen | the length of the key. |
The storage for keybuf
may be released or modified after the command has been spooled.
enum lcb_DUMPFLAGS |
void lcb_dump | ( | lcb_INSTANCE * | instance, |
FILE * | fp, | ||
lcb_U32 | flags ) |
Write a textual dump to a file.
This function will inspect the various internal structures of the current client handle (indicated by instance
) and write the state information to the file indicated by fp
.
instance | the handle to dump |
fp | the file to which the dump should be written |
flags | a set of modifiers (of lcb_DUMPFLAGS) indicating what information to dump. Note that a standard set of information is always dumped, but by default more verbose information is hidden, and may be enabled with these flags. |
lcb_HISTOGRAM * lcb_histogram_create | ( | void | ) |
void lcb_histogram_destroy | ( | lcb_HISTOGRAM * | hg | ) |
void lcb_histogram_record | ( | lcb_HISTOGRAM * | hg, |
lcb_U64 | duration ) |
hg | the histogram |
duration | the duration in nanoseconds |
void lcb_histogram_read | ( | const lcb_HISTOGRAM * | hg, |
const void * | cookie, | ||
lcb_HISTOGRAM_CALLBACK | cb ) |
hg | the histogram |
cookie | pointer passed to callback |
cb | callback to invoke |
void lcb_histogram_print | ( | lcb_HISTOGRAM * | hg, |
FILE * | stream ) |
Print the histogram to the specified FILE.
This essentially outputs the same raw information as lcb_histogram_read(), except it prints in implementation-defined format. It's simpler to use than lcb_histogram_read, but less flexible.
hg | the histogram |
stream | File to print the histogram to. |
void * lcb_mem_alloc | ( | lcb_SIZE | size | ) |
Functions to allocate and free memory related to libcouchbase.
This is mainly for use on Windows where it is possible that the DLL and EXE are using two different CRTs
LCB_INTERNAL_API void lcb_run_loop | ( | lcb_INSTANCE * | instance | ) |
These two functions unconditionally start and stop the event loop. These should be used only when necessary. Use lcb_wait and lcb_breakout for safer variants.
Internally these proxy to the run_event_loop/stop_event_loop calls
LCB_INTERNAL_API void lcb_stop_loop | ( | lcb_INSTANCE * | instance | ) |
LCB_INTERNAL_API lcb_U64 lcb_nstime | ( | void | ) |