Couchbase C Client  3.1.2
Asynchronous C Client for Couchbase

Detailed Description

Clear the contents of a bucket.

Flush is useful for development environments (for example clearing a bucket before running tests).

Modules

 Collections Management
 Managing collections in the bucket.
 
 Timings
 Determine how long operations are taking to be completed.
 

Functions

void lcb_dump (lcb_INSTANCE *instance, FILE *fp, lcb_U32 flags)
 
Write a textual dump to a file. More...
 
lcb_HISTOGRAM * lcb_histogram_create (void)
 
More...
 
void lcb_histogram_destroy (lcb_HISTOGRAM *hg)
 
More...
 
void lcb_histogram_record (lcb_HISTOGRAM *hg, lcb_U64 duration)
 
More...
 
void lcb_histogram_read (const lcb_HISTOGRAM *hg, const void *cookie, lcb_HISTOGRAM_CALLBACK cb)
 
More...
 
void lcb_histogram_print (lcb_HISTOGRAM *hg, FILE *stream)
 Print the histogram to the specified FILE. More...
 
const char * lcb_resp_get_error_context (int cbtype, const lcb_RESPBASE *rb)
 
More...
 
const char * lcb_resp_get_error_ref (int cbtype, const lcb_RESPBASE *rb)
 
More...
 
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)
 

Typedefs

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_DUMPFLAGS
 

Creating Commands

Issuing a command to the Cluster involves selecting the correct command structure, populating it with the data relevant for the command, optionally associating the command with your own application data, issuing the command to a spooling function, and finally receiving the response.

Command structures all derive from the common lcb_CMDBASE structure. This structure defines the common fields for all commands.

Almost all commands need to contain a key, which should be assigned using the LCB_CMD_SET_KEY() macro.

lcb_STATUS lcb_cbflush3 (lcb_INSTANCE *instance, void *cookie, const lcb_CMDCBFLUSH *cmd)
 
More...
 

Function Documentation

◆ lcb_cbflush3()

lcb_STATUS lcb_cbflush3 ( lcb_INSTANCE instance,
void *  cookie,
const lcb_CMDCBFLUSH *  cmd 
)


Stability
Uncommitted:

Flush a bucket This function will properly flush any type of bucket using the REST API via HTTP.

The callback invoked under LCB_CALLBACK_CBFLUSH will be invoked with either a success or failure status depending on the outcome of the operation. Note that in order for lcb_cbflush3() to succeed, flush must already be enabled on the bucket via the administrative interface.

Parameters
instancethe library handle
cookiethe cookie passed in the callback
cmdempty command structure. Currently there are no options for this command.
Returns
status code for scheduling.
Attention
Because this command is built using HTTP, this is not subject to operation pipeline calls such as lcb_sched_enter()/lcb_sched_leave()

◆ lcb_dump()

void lcb_dump ( lcb_INSTANCE instance,
FILE *  fp,
lcb_U32  flags 
)


Write a textual dump to a file.

Stability
Volatile:

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.

Parameters
instancethe handle to dump
fpthe file to which the dump should be written
flagsa 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_create()

lcb_HISTOGRAM* lcb_histogram_create ( void  )


Stability
Volatile:
Create a histogram structure
Returns
a new histogram structure

◆ lcb_histogram_destroy()

void lcb_histogram_destroy ( lcb_HISTOGRAM *  hg)


Stability
Volatile:
free a histogram structure
Parameters
hgthe histogram

◆ lcb_histogram_record()

void lcb_histogram_record ( lcb_HISTOGRAM *  hg,
lcb_U64  duration 
)


Stability
Volatile:
Add an entry to a histogram structure
Parameters
hgthe histogram
durationthe duration in nanoseconds

◆ lcb_histogram_read()

void lcb_histogram_read ( const lcb_HISTOGRAM *  hg,
const void *  cookie,
lcb_HISTOGRAM_CALLBACK  cb 
)


Stability
Volatile:
Repeatedly invoke a callback for all entries in the histogram
Parameters
hgthe histogram
cookiepointer passed to callback
cbcallback to invoke

◆ lcb_histogram_print()

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.

Parameters
hgthe histogram
streamFile to print the histogram to.

◆ lcb_resp_get_error_context()

const char* lcb_resp_get_error_context ( int  cbtype,
const lcb_RESPBASE *  rb 
)


Stability
Volatile:

Retrieves the extra error context from the response structure.

This context does not duplicate information described by status code rendered by lcb_strerror() function, and should be logged if available.

Returns
the pointer to string or NULL if context wasn't specified.

◆ lcb_resp_get_error_ref()

const char* lcb_resp_get_error_ref ( int  cbtype,
const lcb_RESPBASE *  rb 
)


Stability
Uncommitted:

Retrieves the error reference id from the response structure.

Error reference id (or event id) should be logged to allow administrators match client-side events with cluster logs.

Returns
the pointer to string or NULL if ref wasn't specified.

Enumeration Type Documentation

◆ lcb_DUMPFLAGS

Enumerator
LCB_DUMP_VBCONFIG 

Dump the raw vbucket configuration.

LCB_DUMP_PKTINFO 

Dump information about each packet.

LCB_DUMP_BUFINFO 

Dump memory usage/reservation information about buffers.

LCB_DUMP_METRICS 

Dump various metrics information.

LCB_DUMP_ALL 

Dump everything.