Name

lcb_get_server_list — get the list of servers in use

Synopsis

cc [ flag … ] file… -lcouchbase [ library … ]

#include <libcouchbase/couchbase.h>
const char * const *lcb_get_server_list(lcb_tinstance);

DESCRIPTION

lcb_get_server_list() returns a list of 0-terminated strings consisting of hostname:port entries for the entire cluster. The list is only valid until the next call to libcouchbase (or you return the control to libcouchbase if called from a callback).

RETURN VALUES

lcb_get_server_list() returns NULL if the topology of the cluster isn’t known, otherwise a NULL terminated list of 0-terminated strings.

EXAMPLES

#include <libcouchbase/couchbase.h>
...
lcb_t instance;
...
const char *const *servers = lcb_get_server_list(tmphandle);
fprintf(stdout, "Using the following servers: \n");
for (int ii = 0; servers[ii] != NULL; ii++) {
    fprintf(stdout, "[%s]\n", servers[ii]);
}
...

ATTRIBUTES

See lcb_attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE

Interface Stability

Committed

MT-Level

MT-Safe

COPYRIGHT

Copyright 2010-2013 Couchbase, Inc.

SEE ALSO

Learn more at http://www.couchbase.com/communities/c.

libcouchbase(3lib), lcb_create(3couchbase), lcb_attributes(5)