= lcb_set_configuration_callback(3couchbase) :doctype: manpage Trond Norbye NAME ---- lcb_set_configuration_callback - Set callback for cluster topology changes SYNOPSIS -------- cc [ flag ... ] file... -lcouchbase [ library ... ] #include lcb_configuration_callback lcb_set_configuration_callback(lcb_t instance, lcb_configuration_callback callback); DESCRIPTION ----------- lcb_set_configuration_callback() is used to set a new callback function to handle configuration changes received from the cluster for the given instance. The callback parameter is a the callback function to call whenever a new configuration is received from the cluster. Passing NULL as the callback function may be used to query the current callback function. The lcb_configuration_callback is a function with the following signature: void function(lcb_t instance, lcb_configuration_t config); instance is the libcouchbase instance that this response is called from. The config parameter is the type of configuration change: LCB_CONFIGURATION_NEW A new cluster configuration was received. LCB_CONFIGURATION_CHANGED Changes to the current cluster configuration was received. LCB_CONFIGURATION_UNCHANGED The current cluster sent out notifications, but nothing new in configuration. RETURN VALUES ------------- lcb_set_configuration_callback() returns the previous callback function. EXAMPLES -------- Example 1: Query the current callback #include ... lcb_t instance; ... lcb_configuration_callback old; old = lcb_set_configuration_callback(instance, NULL); ... Example 2: Install custom callback #include ... static void callback(lcb_t instance, lcb_configuration_t config) { switch (config) { case LCB_CONFIGURATION_NEW: fprintf(stdout, "Received new cluster configuration\n"); break; case LCB_CONFIGURATION_CHANGED: fprintf(stderr, "Received cluster change notification0); break; case LCB_CONFIGURATION_UNCHANGED: fprintf(stderr, "Received cluster notification0); break; default: fprintf(stderr, "Unknown configuration type received0); } } ... lcb_t instance; ... lcb_set_configuration_callback(instance, callback); ... ATTRIBUTES ---------- See lcb_attributes(5) for descriptions of the following attributes: [options="header"] |======================================= | ATTRIBUTE TYPE | ATTRIBUTE VALUE | Interface Stability | Committed | MT-Level | MT-Safe |======================================= COPYRIGHT --------- Copyright 2010-2013 Couchbase, Inc. SEE ALSO -------- Learn more at . libcouchbase(3lib), lcb_create(3couchbase), lcb_attributes(5)