Couchbase C Client  3.2.2
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...
 

Macros

#define LCBVB_SVCTYPE_CBAS
 
#define LCBVB_BUCKET_NAME(cfg)
 
#define LCBVB_NSERVERS(cfg)
 
#define LCBVB_NDATASERVERS(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)
 
More...
 
#define lcbvb_nmv_remap(cfg, vbid, bad)
 uncommitted Equivalent to More...
 
#define VBUCKET_DISTRIBUTION_VBUCKET
 
#define VBUCKET_DISTRIBUTION_KETAMA
 
#define VBUCKET_NO_CHANGES
 
#define VBUCKET_SERVERS_MODIFIED
 
#define VBUCKET_MAP_MODIFIED
 

Typedefs

typedef struct lcbvb_CONFIGDIFF VBUCKET_CONFIG_DIFF
 
typedef enum lcbvb_CHANGETYPE VBUCKET_CHANGE_STATUS
 
typedef lcbvb_CONFIGVBUCKET_CONFIG_HANDLE
 
typedef lcbvb_DISTMODE VBUCKET_DISTRIBUTION_TYPE
 

Enumerations

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_BUCKET_CAPABILITIES
 
enum  lcbvb_CLUSTER_CAPABILITIES
 
enum  lcbvb_CHANGETYPE
 Convenience enum to determine the mode of change. More...
 
enum  vbucket_source_t
 

Functions

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 More...
 
lcbvb_CONFIGlcbvb_parse_json (const char *data)
 
More...
 
int lcbvb_load_json (lcbvb_CONFIG *vbc, const char *data)
 
More...
 
int lcbvb_load_json_ex (lcbvb_CONFIG *vbc, const char *data, const char *source, char **network)
 
More...
 
char * lcbvb_save_json (lcbvb_CONFIG *vbc)
 Serialize the current config as a JSON string. More...
 
const char * lcbvb_get_error (const lcbvb_CONFIG *vbc)
 
Return a string indicating why parsing the configuration failed More...
 
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. More...
 
void lcbvb_destroy (lcbvb_CONFIG *conf)
 
More...
 
int lcbvb_vbmaster (lcbvb_CONFIG *cfg, int vbid)
 
More...
 
int lcbvb_vbreplica (lcbvb_CONFIG *cfg, int vbid, unsigned ix)
 
More...
 
int lcbvb_nmv_remap_ex (lcbvb_CONFIG *cfg, int vbid, int bad, int use_heuristics)
 
More...
 
int lcbvb_map_key (lcbvb_CONFIG *cfg, const void *key, lcb_SIZE n, int *vbid, int *srvix)
 
More...
 
int lcbvb_k2vb (lcbvb_CONFIG *cfg, const void *key, lcb_SIZE n)
 
More...
 
int lcbvb_has_vbucket (lcbvb_CONFIG *vbc, int vbid, int ix)
 
More...
 
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. More...
 
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. More...
 
unsigned lcbvb_get_nvbuckets (const lcbvb_CONFIG *cfg)
 Get the number of vbuckets the bucket is configured with. More...
 
lcbvb_DISTMODE lcbvb_get_distmode (const lcbvb_CONFIG *cfg)
 Get the distribution mode (AKA bucket type) of the bucket. More...
 
int lcbvb_get_revision (const lcbvb_CONFIG *cfg)
 
Get the revision for this configuration. More...
 
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 More...
 
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 More...
 
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. More...
 
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. More...
 
int lcbvb_get_randhost (const lcbvb_CONFIG *cfg, lcbvb_SVCTYPE type, lcbvb_SVCMODE mode)
 Convenience function to select a random node for a service. More...
 
int lcbvb_get_randhost_ex (const lcbvb_CONFIG *cfg, lcbvb_SVCTYPE type, lcbvb_SVCMODE mode, int *used)
 Get random node, excluding nodes already tried. More...
 
lcbvb_CONFIGDIFFlcbvb_compare (lcbvb_CONFIG *from, lcbvb_CONFIG *to)
 
Compare two configurations and return information on the changes More...
 
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. More...
 
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. More...
 
int lcbvb_genconfig (lcbvb_CONFIG *vb, unsigned nservers, unsigned nreplica, unsigned nvbuckets)
 
Generate a sample configuration used for testing. More...
 
void lcbvb_genffmap (lcbvb_CONFIG *vb)
 
More...
 
void lcbvb_make_ketama (lcbvb_CONFIG *vb)
 
More...
 
const char * lcbvb_get_capibase (lcbvb_CONFIG *cfg, unsigned ix, lcbvb_SVCMODE mode)
 
More...
 
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