Skip to content

Commit

Permalink
MB-16181: Interface update, allow DCP open to accept a value
Browse files Browse the repository at this point in the history
DCP consumers will be able to open a DCP stream and specify a filter,
a list of collections they are interested in. This filter will be
passed as a JSON 'value' to DCP open.

Change-Id: Id33306f0d663b263840f70c44a16deff6db0a89e
Reviewed-on: http://review.couchbase.org/78038
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information
jimwwalker authored and trondn committed May 15, 2017
1 parent 59253c5 commit dd74217
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 159 deletions.
23 changes: 11 additions & 12 deletions src/ep_engine.cc
Expand Up @@ -1364,16 +1364,15 @@ static ENGINE_ERROR_CODE EvpDcpStep(ENGINE_HANDLE* handle,
return ENGINE_DISCONNECT;
}


static ENGINE_ERROR_CODE EvpDcpOpen(ENGINE_HANDLE* handle,
const void* cookie,
uint32_t opaque,
uint32_t seqno,
uint32_t flags,
void* name,
uint16_t nname) {
cb::const_char_buffer name,
cb::const_byte_buffer jsonExtra) {
return acquireEngine(handle)->dcpOpen(
cookie, opaque, seqno, flags, name, nname);
cookie, opaque, seqno, flags, name, jsonExtra);
}

static ENGINE_ERROR_CODE EvpDcpAddStream(ENGINE_HANDLE* handle,
Expand Down Expand Up @@ -6012,16 +6011,16 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::getRandomKey(const void *cookie,
return ret;
}

ENGINE_ERROR_CODE EventuallyPersistentEngine::dcpOpen(const void* cookie,
uint32_t opaque,
uint32_t seqno,
uint32_t flags,
const void *stream_name,
uint16_t nname)
{
ENGINE_ERROR_CODE EventuallyPersistentEngine::dcpOpen(
const void* cookie,
uint32_t opaque,
uint32_t seqno,
uint32_t flags,
cb::const_char_buffer stream_name,
cb::const_byte_buffer jsonExtra) {
(void) opaque;
(void) seqno;
std::string connName(static_cast<const char*>(stream_name), nname);
std::string connName = cb::to_string(stream_name);

if (reserveCookie(cookie) != ENGINE_SUCCESS) {
LOG(EXTENSION_LOG_WARNING, "Cannot create DCP connection because cookie"
Expand Down
4 changes: 2 additions & 2 deletions src/ep_engine.h
Expand Up @@ -268,8 +268,8 @@ class EventuallyPersistentEngine : public ENGINE_HANDLE_V1 {
uint32_t opaque,
uint32_t seqno,
uint32_t flags,
const void *stream_name,
uint16_t nname);
cb::const_char_buffer stream_name,
cb::const_byte_buffer jsonExtra);

ENGINE_ERROR_CODE dcpAddStream(const void* cookie,
uint32_t opaque,
Expand Down
4 changes: 2 additions & 2 deletions tests/ep_perfsuite.cc
Expand Up @@ -862,8 +862,8 @@ static void perf_dcp_client(ENGINE_HANDLE* h, ENGINE_HANDLE_V1* h1,
uint64_t vb_uuid = get_ull_stat(h, h1, uuid.c_str(), "failovers");
uint32_t streamOpaque = opaque;

checkeq(h1->dcp.open(h, cookie, ++streamOpaque, 0, DCP_OPEN_PRODUCER,
(void*)name.c_str(), name.length()),
checkeq(h1->dcp.open(
h, cookie, ++streamOpaque, 0, DCP_OPEN_PRODUCER, name, {}),
ENGINE_SUCCESS,
"Failed dcp producer open connection");

Expand Down

0 comments on commit dd74217

Please sign in to comment.