Skip to content

Commit

Permalink
Merge "Merge commit 'couchbase/neo' into 'couchbase/master'"
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit Code Review committed Jan 6, 2023
2 parents 43dfbe6 + f2ed693 commit b6752ab
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion engines/ep/src/dcp/active_stream.cc
Expand Up @@ -1079,7 +1079,7 @@ static bool shouldModifyItem(const queued_item& item,
}

std::unique_ptr<DcpResponse> ActiveStream::makeResponseFromItem(
const queued_item& item, SendCommitSyncWriteAs sendCommitSyncWriteAs) {
queued_item& item, SendCommitSyncWriteAs sendCommitSyncWriteAs) {
// Note: This function is hot - it is called for every item to be
// sent over the DCP connection.

Expand Down
3 changes: 1 addition & 2 deletions engines/ep/src/dcp/active_stream.h
Expand Up @@ -529,8 +529,7 @@ class ActiveStream : public Stream,
* AbortSyncWrite.
*/
std::unique_ptr<DcpResponse> makeResponseFromItem(
const queued_item& item,
SendCommitSyncWriteAs sendCommitSyncWriteAs);
queued_item& item, SendCommitSyncWriteAs sendCommitSyncWriteAs);

/* The transitionState function is protected (as opposed to private) for
* testing purposes.
Expand Down
3 changes: 2 additions & 1 deletion engines/ep/src/dcp/producer.cc
Expand Up @@ -865,7 +865,8 @@ cb::engine_errc DcpProducer::step(bool throttled,
s->getVersion(),
{reinterpret_cast<const uint8_t*>(s->getKey().data()),
s->getKey().size()},
s->getEventData(),
{reinterpret_cast<const uint8_t*>(s->getEventData().data()),
s->getEventData().size()},
resp->getStreamId());
break;
}
Expand Down
31 changes: 16 additions & 15 deletions engines/ep/src/dcp/response.h
Expand Up @@ -836,7 +836,7 @@ class SystemEventMessage : public DcpResponse {
sizeof(uint32_t) + sizeof(uint8_t);
virtual mcbp::systemevent::id getSystemEvent() const = 0;
virtual std::string_view getKey() const = 0;
virtual cb::const_byte_buffer getEventData() const = 0;
virtual std::string_view getEventData() const = 0;
virtual mcbp::systemevent::version getVersion() const = 0;
};

Expand Down Expand Up @@ -884,8 +884,9 @@ class SystemEventConsumerMessage : public SystemEventMessage {
return key;
}

cb::const_byte_buffer getEventData() const override {
return {eventData.data(), eventData.size()};
std::string_view getEventData() const override {
return {reinterpret_cast<const char*>(eventData.data()),
eventData.size()};
}

mcbp::systemevent::version getVersion() const override {
Expand Down Expand Up @@ -921,8 +922,8 @@ class SystemEventProducerMessage : public SystemEventMessage {
* @return a SystemEventMessage unique pointer constructed from the
* queued_item data.
*/
static std::unique_ptr<SystemEventProducerMessage>
make(uint32_t opaque, const queued_item& item, cb::mcbp::DcpStreamId sid);
static std::unique_ptr<SystemEventProducerMessage> make(
uint32_t opaque, queued_item& item, cb::mcbp::DcpStreamId sid);

uint32_t getMessageSize() const override {
return SystemEventMessage::baseMsgBytes + getKey().size() +
Expand Down Expand Up @@ -989,8 +990,8 @@ class CollectionCreateProducerMessage : public SystemEventProducerMessage {
return {key.data(), key.size()};
}

cb::const_byte_buffer getEventData() const override {
return {reinterpret_cast<const uint8_t*>(&eventData),
std::string_view getEventData() const override {
return {reinterpret_cast<const char*>(&eventData),
Collections::CreateEventDcpData::size};
}

Expand Down Expand Up @@ -1023,8 +1024,8 @@ class CollectionCreateWithMaxTtlProducerMessage
return {key.data(), key.size()};
}

cb::const_byte_buffer getEventData() const override {
return {reinterpret_cast<const uint8_t*>(&eventData),
std::string_view getEventData() const override {
return {reinterpret_cast<const char*>(&eventData),
Collections::CreateWithMaxTtlEventDcpData::size};
}

Expand Down Expand Up @@ -1053,8 +1054,8 @@ class CollectionDropProducerMessage : public SystemEventProducerMessage {
return {/* no key value for a drop event*/};
}

cb::const_byte_buffer getEventData() const override {
return {reinterpret_cast<const uint8_t*>(&eventData),
std::string_view getEventData() const override {
return {reinterpret_cast<const char*>(&eventData),
Collections::DropEventDcpData::size};
}

Expand Down Expand Up @@ -1085,8 +1086,8 @@ class ScopeCreateProducerMessage : public SystemEventProducerMessage {
return {key.data(), key.size()};
}

cb::const_byte_buffer getEventData() const override {
return {reinterpret_cast<const uint8_t*>(&eventData),
std::string_view getEventData() const override {
return {reinterpret_cast<const char*>(&eventData),
Collections::CreateScopeEventDcpData::size};
}

Expand Down Expand Up @@ -1115,8 +1116,8 @@ class ScopeDropProducerMessage : public SystemEventProducerMessage {
return {/* no key value for a drop event*/};
}

cb::const_byte_buffer getEventData() const override {
return {reinterpret_cast<const uint8_t*>(&eventData),
std::string_view getEventData() const override {
return {reinterpret_cast<const char*>(&eventData),
Collections::DropScopeEventDcpData::size};
}

Expand Down
3 changes: 1 addition & 2 deletions engines/ep/src/systemevent_factory.cc
Expand Up @@ -117,7 +117,7 @@ std::pair<SystemEvent, uint32_t> SystemEventFactory::getTypeAndID(
}

std::unique_ptr<SystemEventProducerMessage> SystemEventProducerMessage::make(
uint32_t opaque, const queued_item& item, cb::mcbp::DcpStreamId sid) {
uint32_t opaque, queued_item& item, cb::mcbp::DcpStreamId sid) {
// Always ensure decompressed as we are about to use the value
item->decompressValue();
switch (SystemEvent(item->getFlags())) {
Expand All @@ -133,7 +133,6 @@ std::unique_ptr<SystemEventProducerMessage> SystemEventProducerMessage::make(
opaque, item, data, sid);
} else {
return std::make_unique<CollectionCreateProducerMessage>(

opaque, item, data, sid);
}
} else {
Expand Down

0 comments on commit b6752ab

Please sign in to comment.