use “lcb_flush” to remove all data of a Couchbase bucket , return an error “Not supported”, but it goes well in a Memcached bucket .
can some one tell me why , or is there something should be set?
libcouchbase version: libcouchbase.so.2.0.12
platform : CentOS release 6.2 (Final)
code :
int main(int argc ,char* argv[]){
lcb_t instance;
lcb_error_t err;
struct lcb_create_st create_options;
memset(&create_options, 0, sizeof(create_options));
create_options.v.v0.host = "172.26.181.235;172.26.181.234";
create_options.v.v0.user = "";
create_options.v.v0.passwd = "";
create_options.v.v0.bucket = "traffic3";
create_options.v.v1.type = LCB_TYPE_BUCKET;
err = lcb_create(&instance, &create_options);
if (err != LCB_SUCCESS) {
fprintf(stderr, "Failed to create libcouchbase instance: %s\n",
lcb_strerror(NULL, err));
return 1;
}
lcb_set_error_callback(instance, error_callback);
err = lcb_connect(instance);
if (err != LCB_SUCCESS) {
fprintf(stderr, "Failed to initiate connect: %s\n",lcb_strerror(NULL, err));
return 1;
}
/* run the event loop and wait until we've connected */
lcb_wait(instance);
lcb_set_flush_callback(instance, flush_callback);
lcb_flush_cmd_t cmd;
lcb_flush_cmd_t* commands[1];
memset(&cmd, 0, sizeof(cmd));
cmd.version = 0;
commands[0] = &cmd;
lcb_flush(instance, NULL, 1, commands);
lcb_wait(instance);
lcb_destroy(instance);
return 0;
}