Skip to content

Commit

Permalink
MB-8729: Add get_engine_vb_map interface for CCCP
Browse files Browse the repository at this point in the history
Allow the engine to specify the new vbucket map

Change-Id: I2459372d5c958445063d50a4c77c9058b0e34de9
Reviewed-on: http://review.couchbase.org/29845
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information
trondn committed Oct 30, 2013
1 parent 2a797a8 commit 0a3a9df
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion bucket_engine.c
Expand Up @@ -172,6 +172,10 @@ static TAP_ITERATOR bucket_get_tap_iterator(ENGINE_HANDLE* handle, const void* c
static size_t bucket_errinfo(ENGINE_HANDLE *handle, const void* cookie,
char *buffer, size_t buffsz);

static ENGINE_ERROR_CODE bucket_get_engine_vb_map(ENGINE_HANDLE* handle,
const void * cookie,
engine_get_vb_map_cb callback);

static ENGINE_HANDLE *load_engine(void **dlhandle, const char *soname);

static bool is_authorized(ENGINE_HANDLE* handle, const void* cookie);
Expand Down Expand Up @@ -210,7 +214,8 @@ struct bucket_engine bucket_engine = {
.get_tap_iterator = bucket_get_tap_iterator,
.item_set_cas = bucket_item_set_cas,
.get_item_info = bucket_get_item_info,
.errinfo = bucket_errinfo
.errinfo = bucket_errinfo,
.get_engine_vb_map = bucket_get_engine_vb_map
},
.initialized = false,
.shutdown = {
Expand Down Expand Up @@ -2027,6 +2032,25 @@ static size_t bucket_errinfo(ENGINE_HANDLE *handle, const void* cookie,
return ret;
}

static ENGINE_ERROR_CODE bucket_get_engine_vb_map(ENGINE_HANDLE* handle,
const void * cookie,
engine_get_vb_map_cb callback) {
proxied_engine_handle_t *peh = try_get_engine_handle(handle, cookie);
ENGINE_ERROR_CODE ret = ENGINE_SUCCESS;

if (peh) {
if (peh->pe.v1->get_engine_vb_map) {
ret = peh->pe.v1->get_engine_vb_map(peh->pe.v0, cookie, callback);
} else {
ret = ENGINE_ENOTSUP;
}
release_engine_handle(peh);
}

return ret;
}


/**
* Initialize configuration is called during the initialization of
* bucket_engine. It tries to parse the configuration string to pick
Expand Down

0 comments on commit 0a3a9df

Please sign in to comment.