Why "lcb_flush" function return an error "Not supported"?

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 = ";";
    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_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);
    return 0;

Because the given server version does not support FLUSH command. You have to use RESTful flush. http://docs.couchbase.com/couchbase-manual-2.5/cb-rest-api/#flushing-buckets

is this means there is no way to flush a couchbase bucket with C function , only http request can reach that point ?

using the POST HTTP operation:
For example, using curl :
curl -X POST ‘http://admin:password@localhost:8091/pools/default/buckets/default/controller/doFlush

You can also use libcouchbase API to do that. For example our cbc tool has command bucket-flush:

$ cbc bucket-flush -u Administrator -P password default
Server: Couchbase Server
Pragma: no-cache
Date: Tue, 25 Mar 2014 05:10:19 GMT
Content-Length: 0
Cache-Control: no-cache
"/pools/default/buckets/default/controller/doFlush": OK Size:0

You can find implementation here:

got it . thank you .

by the way , you stay up so late . it’s just two o’clock afternoon for me in shanghai , sleep tight.

I’m in FET (UTC+3) timezone

my mistake, good morning !