int noit_console_config_unsetconfig(noit_console_closure_t ncct, int argc, char **argv, noit_console_state_t *state, void *closure) { noit_conf_t_userdata_t *info; info = noit_console_userdata_get(ncct, NOIT_CONF_T_USERDATA); if(argc != 1) { nc_printf(ncct, "one argument required.\n"); return -1; } /* Okay, we have an child name and it should be culled from * current path/config. */ if(replace_config(ncct, info, argv[0], NULL)) { return -1; } /* So, we updated an attribute, so we need to reload all checks * that are descendent-or-self of this node. */ refresh_subchecks(ncct, info); return 0; }
void lcb_update_vbconfig(lcb_t instance, clconfig_info *config) { lcb_size_t ii; int change_status; clconfig_info *old_config; mc_CMDQUEUE *q = &instance->cmdq; old_config = instance->cur_configinfo; instance->cur_configinfo = config; instance->dist_type = VB_DISTTYPE(config->vbc); lcb_clconfig_incref(config); instance->nreplicas = (lcb_uint16_t)VB_NREPLICAS(config->vbc); q->config = instance->cur_configinfo->vbc; q->instance = instance; if (old_config) { if (is_new_config(instance, old_config->vbc, config->vbc)) { change_status = replace_config(instance, config); if (change_status == -1) { LOG(instance, ERR, "Couldn't replace config"); return; } lcb_clconfig_decref(old_config); } else { change_status = LCB_CONFIGURATION_UNCHANGED; } } else { unsigned nservers; mc_PIPELINE **servers; nservers = VB_NSERVERS(config->vbc); if ((servers = malloc(sizeof(*servers) * nservers)) == NULL) { abort(); } for (ii = 0; ii < nservers; ii++) { mc_SERVER *srv; if ((srv = mcserver_alloc(instance, ii)) == NULL) { abort(); } servers[ii] = &srv->pipeline; } mcreq_queue_add_pipelines(q, servers, nservers, config->vbc); change_status = LCB_CONFIGURATION_NEW; } /* Notify anyone interested in this event... */ if (change_status != LCB_CONFIGURATION_UNCHANGED) { if (instance->vbucket_state_listener != NULL) { for (ii = 0; ii < q->npipelines; ii++) { lcb_server_t *server = (lcb_server_t *)q->pipelines[ii]; instance->vbucket_state_listener(server); } } } instance->callbacks.configuration(instance, change_status); lcb_maybe_breakout(instance); }