Skip to content

Commit 493d6d1

Browse files
trondndaverigby
authored andcommitted
Add BinprotCompactDbCommand
Change-Id: Ied21fa9501a7bc2486fe47b0a3f7e5a6832635f7 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/138033 Tested-by: Build Bot <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 7c80966 commit 493d6d1

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

protocol/connection/client_mcbp_commands.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,3 +1893,13 @@ void BinprotEWBCommand::encode(std::vector<uint8_t>& buf) const {
18931893
buf.insert(buf.end(), extraBuf.begin(), extraBuf.end());
18941894
buf.insert(buf.end(), key.begin(), key.end());
18951895
}
1896+
1897+
BinprotCompactDbCommand::BinprotCompactDbCommand()
1898+
: BinprotGenericCommand(cb::mcbp::ClientOpcode::CompactDb) {
1899+
}
1900+
1901+
void BinprotCompactDbCommand::encode(std::vector<uint8_t>& buf) const {
1902+
writeHeader(buf, 0, sizeof(extras));
1903+
auto extraBuf = extras.getBuffer();
1904+
buf.insert(buf.end(), extraBuf.begin(), extraBuf.end());
1905+
}

protocol/connection/client_mcbp_commands.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,3 +1116,38 @@ class BinprotEWBCommand : public BinprotGenericCommand {
11161116
ENGINE_ERROR_CODE err_code;
11171117
uint32_t value;
11181118
};
1119+
1120+
class BinprotCompactDbCommand : public BinprotGenericCommand {
1121+
public:
1122+
BinprotCompactDbCommand();
1123+
1124+
void encode(std::vector<uint8_t>& buf) const override;
1125+
1126+
uint64_t getPurgeBeforeTs() const {
1127+
return extras.getPurgeBeforeTs();
1128+
}
1129+
void setPurgeBeforeTs(uint64_t purge_before_ts) {
1130+
extras.setPurgeBeforeTs(purge_before_ts);
1131+
}
1132+
uint64_t getPurgeBeforeSeq() const {
1133+
return extras.getPurgeBeforeSeq();
1134+
}
1135+
void setPurgeBeforeSeq(uint64_t purge_before_seq) {
1136+
extras.setPurgeBeforeSeq(purge_before_seq);
1137+
}
1138+
uint8_t getDropDeletes() const {
1139+
return extras.getDropDeletes();
1140+
}
1141+
void setDropDeletes(uint8_t drop_deletes) {
1142+
extras.setDropDeletes(drop_deletes);
1143+
}
1144+
const Vbid getDbFileId() const {
1145+
return extras.getDbFileId();
1146+
}
1147+
void setDbFileId(Vbid db_file_id) {
1148+
extras.setDbFileId(db_file_id);
1149+
}
1150+
1151+
protected:
1152+
cb::mcbp::request::CompactDbPayload extras;
1153+
};

0 commit comments

Comments
 (0)