mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
feat: support deletions with meta protocol (#4398)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
6e9409c65c
commit
4f09fe036c
4 changed files with 9 additions and 3 deletions
|
@ -283,6 +283,10 @@ void MCReplyBuilder::SendMiss() {
|
||||||
SendSimpleString("EN");
|
SendSimpleString("EN");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MCReplyBuilder::SendDeleted() {
|
||||||
|
SendSimpleString(flag_.meta ? "HD" : "DELETED");
|
||||||
|
}
|
||||||
|
|
||||||
void MCReplyBuilder::SendRaw(std::string_view str) {
|
void MCReplyBuilder::SendRaw(std::string_view str) {
|
||||||
ReplyScope scope(this);
|
ReplyScope scope(this);
|
||||||
WriteRef(str);
|
WriteRef(str);
|
||||||
|
@ -422,7 +426,7 @@ void RedisReplyBuilder::SendScoredArray(ScoredArray arr, bool with_scores) {
|
||||||
|
|
||||||
void RedisReplyBuilder::SendLabeledScoredArray(std::string_view arr_label, ScoredArray arr) {
|
void RedisReplyBuilder::SendLabeledScoredArray(std::string_view arr_label, ScoredArray arr) {
|
||||||
ReplyScope scope(this);
|
ReplyScope scope(this);
|
||||||
|
|
||||||
StartArray(2);
|
StartArray(2);
|
||||||
|
|
||||||
SendBulkString(arr_label);
|
SendBulkString(arr_label);
|
||||||
|
@ -432,7 +436,6 @@ void RedisReplyBuilder::SendLabeledScoredArray(std::string_view arr_label, Score
|
||||||
SendBulkString(str);
|
SendBulkString(str);
|
||||||
SendDouble(score);
|
SendDouble(score);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RedisReplyBuilder::SendStored() {
|
void RedisReplyBuilder::SendStored() {
|
||||||
|
|
|
@ -172,6 +172,7 @@ class MCReplyBuilder : public SinkReplyBuilder {
|
||||||
void SendClientError(std::string_view str);
|
void SendClientError(std::string_view str);
|
||||||
void SendNotFound();
|
void SendNotFound();
|
||||||
void SendMiss();
|
void SendMiss();
|
||||||
|
void SendDeleted();
|
||||||
void SendGetEnd();
|
void SendGetEnd();
|
||||||
|
|
||||||
void SendValue(std::string_view key, std::string_view value, uint64_t mc_ver, uint32_t mc_flag);
|
void SendValue(std::string_view key, std::string_view value, uint64_t mc_ver, uint32_t mc_flag);
|
||||||
|
|
|
@ -1023,7 +1023,7 @@ void DeleteGeneric(CmdArgList args, const CommandContext& cmd_cntx) {
|
||||||
if (del_cnt == 0) {
|
if (del_cnt == 0) {
|
||||||
mc_builder->SendNotFound();
|
mc_builder->SendNotFound();
|
||||||
} else {
|
} else {
|
||||||
mc_builder->SendSimpleString("DELETED");
|
mc_builder->SendDeleted();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
builder->SendLong(del_cnt);
|
builder->SendLong(del_cnt);
|
||||||
|
|
|
@ -28,3 +28,5 @@ def test_basic(df_server: DflyInstance):
|
||||||
response = pool.meta_get(Key("key1"), flags=request_flags)
|
response = pool.meta_get(Key("key1"), flags=request_flags)
|
||||||
assert isinstance(response, Success)
|
assert isinstance(response, Success)
|
||||||
assert pool.get("key2") is None
|
assert pool.get("key2") is None
|
||||||
|
assert pool.delete("key1")
|
||||||
|
assert pool.delete("key1") is False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue