Couchbase C Client  3.3.5
Asynchronous C Client for Couchbase
vbucket.h File Reference

vBucket Mapping API More...

#include <libcouchbase/visibility.h>
#include <libcouchbase/sysdefs.h>

Go to the source code of this file.

Data Structures

struct  lcbvb_SERVICES
 Services which may be provided by a node. More...
struct  lcbvb_SERVER
 Node in the cluster This structure represents a node in the cluster. The node has a hostname (hostname), and various services. More...
struct  lcbvb_VBUCKET
struct  lcbvb_CONTINUUM
struct  lcbvb_CONFIG
 Structure containing the configuration. More...
struct  lcbvb_CONFIGDIFF
 Structure representing changes between two configurations. More...


#define LCBVB_BUCKET_NAME(cfg)
#define LCBVB_NSERVERS(cfg)
#define LCBVB_NREPLICAS(cfg)
#define LCBVB_DISTTYPE(cfg)
#define LCBVB_CAPS(cfg)
#define LCBVB_CCAPS(cfg)
#define LCBVB_GET_SERVER(conf, ix)
#define lcbvb_vbserver(cfg, vbid, ix)
#define lcbvb_nmv_remap(cfg, vbid, bad)
 uncommitted Equivalent to




enum  lcbvb_SVCTYPE
 This enum functions as a 'key' to indicate a specific service offered by a node. More...
enum  lcbvb_SVCMODE
 This enum functions to indicate the 'mode' of the service. More...
enum  lcbvb_DISTMODE
 Type of algorithm used to distribute keys. More...
enum  lcbvb_CHANGETYPE
 Convenience enum to determine the mode of change. More...
enum  vbucket_source_t


lcbvb_CONFIGlcbvb_create (void)
 Allocate a new config This can be used to create new config object and load it with a JSON config, optionally retrieving the error code.
lcbvb_CONFIGlcbvb_parse_json (const char *data)
int lcbvb_load_json (lcbvb_CONFIG *vbc, const char *data)
int lcbvb_load_json_ex (lcbvb_CONFIG *vbc, const char *data, const char *source, char **network)
char * lcbvb_save_json (lcbvb_CONFIG *vbc)
 Serialize the current config as a JSON string.
const char * lcbvb_get_error (const lcbvb_CONFIG *vbc)
 Return a string indicating why parsing the configuration failed.
void lcbvb_replace_host (lcbvb_CONFIG *cfg, const char *hostname)
 Replace hostname placeholders with specific host string This function shall replace hostname placeholists with the actual host string specified in hoststr.
void lcbvb_destroy (lcbvb_CONFIG *conf)
int lcbvb_vbmaster (lcbvb_CONFIG *cfg, int vbid)
int lcbvb_vbreplica (lcbvb_CONFIG *cfg, int vbid, unsigned ix)
int lcbvb_nmv_remap_ex (lcbvb_CONFIG *cfg, int vbid, int bad, int use_heuristics)
int lcbvb_map_key (lcbvb_CONFIG *cfg, const void *key, lcb_SIZE n, int *vbid, int *srvix)
int lcbvb_k2vb (lcbvb_CONFIG *cfg, const void *key, lcb_SIZE n)
int lcbvb_has_vbucket (lcbvb_CONFIG *vbc, int vbid, int ix)
unsigned lcbvb_get_nservers (const lcbvb_CONFIG *cfg)
 Get the number of servers in the bucket. Note that not all servers may actually be available.
unsigned lcbvb_get_nreplicas (const lcbvb_CONFIG *cfg)
 Get the number of replicas the bucket is configured with Note that not all replicas may necessarily be online or available.
unsigned lcbvb_get_nvbuckets (const lcbvb_CONFIG *cfg)
 Get the number of vbuckets the bucket is configured with.
lcbvb_DISTMODE lcbvb_get_distmode (const lcbvb_CONFIG *cfg)
 Get the distribution mode (AKA bucket type) of the bucket.
int lcbvb_get_revision (const lcbvb_CONFIG *cfg)
 Get the revision for this configuration.
unsigned lcbvb_get_port (lcbvb_CONFIG *cfg, unsigned ix, lcbvb_SVCTYPE type, lcbvb_SVCMODE mode)
 Gets the port associated with a given service of a given mode on a given server.
const char * lcbvb_get_hostport (lcbvb_CONFIG *cfg, unsigned ix, lcbvb_SVCTYPE type, lcbvb_SVCMODE mode)
 Return a string for the given service This is like lcbvb_get_port but returns a string in the form of host:port rather than the numeric port.
const char * lcbvb_get_hostname (const lcbvb_CONFIG *cfg, unsigned ix)
 Get the hostname of a given server index. This may be used if all nodes reside on different hostnames, and can be used to answer the question of "which node does this index belong to" without having to perform additional string processing on the port of the string.
const char * lcbvb_get_resturl (lcbvb_CONFIG *cfg, unsigned ix, lcbvb_SVCTYPE type, lcbvb_SVCMODE mode)
 Function to return the URL prefix for a REST service.
int lcbvb_get_randhost (const lcbvb_CONFIG *cfg, lcbvb_SVCTYPE type, lcbvb_SVCMODE mode)
 Convenience function to select a random node for a service.
int lcbvb_get_randhost_ex (const lcbvb_CONFIG *cfg, lcbvb_SVCTYPE type, lcbvb_SVCMODE mode, int *used)
 Get random node, excluding nodes already tried.
lcbvb_CONFIGDIFFlcbvb_compare (lcbvb_CONFIG *from, lcbvb_CONFIG *to)
 Compare two configurations and return information on the changes.
void lcbvb_free_diff (lcbvb_CONFIGDIFF *diff)
 Free the structure returned by lcbvb_compare()
lcbvb_CHANGETYPE lcbvb_get_changetype (lcbvb_CONFIGDIFF *diff)
 Get a quick summary of the changes in the passed object.
int lcbvb_genconfig_ex (lcbvb_CONFIG *vb, const char *name, const char *uuid, const lcbvb_SERVER *servers, unsigned nservers, unsigned nreplica, unsigned nvbuckets)
 Generate a sample configuration.
int lcbvb_genconfig (lcbvb_CONFIG *vb, unsigned nservers, unsigned nreplica, unsigned nvbuckets)
 Generate a sample configuration used for testing.
void lcbvb_genffmap (lcbvb_CONFIG *vb)
void lcbvb_make_ketama (lcbvb_CONFIG *vb)
const char * lcbvb_get_capibase (lcbvb_CONFIG *cfg, unsigned ix, lcbvb_SVCMODE mode)
int vbucket_config_parse (lcbvb_CONFIG *, vbucket_source_t, const char *)
const char * vbucket_get_error_message (lcbvb_CONFIG *)
lcbvb_CONFIGvbucket_config_create (void)
void vbucket_config_destroy (lcbvb_CONFIG *)
int vbucket_config_get_num_replicas (lcbvb_CONFIG *)
int vbucket_config_get_num_vbuckets (lcbvb_CONFIG *)
int vbucket_config_get_num_servers (lcbvb_CONFIG *)
const char * vbucket_config_get_server (lcbvb_CONFIG *, int)
const char * vbucket_config_get_couch_api_base (lcbvb_CONFIG *, int)
const char * vbucket_config_get_rest_api_server (lcbvb_CONFIG *, int)
lcbvb_DISTMODE vbucket_config_get_distribution_type (lcbvb_CONFIG *)
int vbucket_map (lcbvb_CONFIG *, const void *, lcb_SIZE, int *, int *)
int vbucket_get_vbucket_by_key (lcbvb_CONFIG *, const void *, lcb_SIZE)
int vbucket_get_master (lcbvb_CONFIG *, int)
int vbucket_get_replica (lcbvb_CONFIG *, int, int)
lcbvb_CONFIGDIFFvbucket_compare (lcbvb_CONFIG *, lcbvb_CONFIG *)
void vbucket_free_diff (lcbvb_CONFIGDIFF *)
int vbucket_config_get_revision (lcbvb_CONFIG *)
lcbvb_CHANGETYPE vbucket_what_changed (lcbvb_CONFIGDIFF *diff)
int vbucket_config_generate (lcbvb_CONFIG *vb, unsigned, unsigned, unsigned)

Detailed Description

vBucket Mapping API