libvbucket - library for virtual buckets mapping
cc [ flag... ] file... -lvbucket [ library...]
#include <libvbucket/vbucket.h>
Functions in this library provide routines that provide a mapping between keys, virtual buckets and the host that serves the virtual buckets.
The shared object libvbucket.so provides the public interfaces defined below. See intro(3) for additional information on shared object interfaces.
- vbucket_config_parse_string
- vbucket_config_destroy
- vbucket_get_error
- vbucket_config_get_num_replicas
- vbucket_config_get_num_vbuckets
- vbucket_config_get_num_servers
- vbucket_config_get_server
- vbucket_get_vbucket_by_key
- vbucket_get_master
- vbucket_get_replica
#include <libvbucket/vbucket.h>
int main(int argc, char **argv) { [ ... cut ... ]
VBUCKET_CONFIG_HANDLE handle;
handle = vbucket_config_parse_file(filename);
if (handle == NULL) {
fprintf(stderr, "Failed to parse vbucket config: %s\n",
vbucket_get_error());
return 1;
}
int serverindex = vbucket_get_master(handle, bucketid);
if (serverindex == -1) {
fprintf(stderr, "No information found for the requested bucket id\n");
vbucket_config_destroy(handle);
return 1;
}
fprintf(stderr, "Bucket %d is served by %s\n", bucketid,
vbucket_config_get_server(handle, serverindex));
vbucket_config_destroy(handle);
return 0;
}
libvbucket(4) vbucket_config_parse_file(3vbucket) vbucket_config_parse_string(3vbucket) vbucket_config_destroy(3vbucket) vbucket_get_error(3vbucket) vbucket_config_get_num_replicas(3vbucket) vbucket_config_get_num_vbuckets(3vbucket) vbucket_config_get_num_servers(3vbucket) vbucket_config_get_server(3vbucket) vbucket_get_vbucket_by_key(3vbucket) vbucket_get_master(3vbucket) vbucket_get_replica(3vbucket)
Hey! The above document had some coding errors, which are explained below:
- Around line 21:
-
=over should be: '=over' or '=over positive_number'