Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

83 lines (49 sloc) 2.034 kb

NAME

libvbucket - library for virtual buckets mapping

SYNOPSIS

cc [ flag... ] file... -lvbucket [ library...]

#include <libvbucket/vbucket.h>

DESCRIPTION

Functions in this library provide routines that provide a mapping between keys, virtual buckets and the host that serves the virtual buckets.

INTERFACES

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

EXAMPLE

#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;
}

SEE ALSO

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)

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 21:

=over should be: '=over' or '=over positive_number'

Jump to Line
Something went wrong with that request. Please try again.