Skip to content

Commit

Permalink
Enable a memory_trim option in DelData
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <[email protected]>
  • Loading branch information
sighingnow committed Feb 27, 2024
1 parent d6a305d commit fef0b1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/common/util/protocols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1213,37 +1213,40 @@ Status ReadListDataRequest(const json& root, std::string& pattern, bool& regex,
}

void WriteDelDataRequest(const ObjectID id, const bool force, const bool deep,
const bool fastpath, std::string& msg) {
const bool memory_trim, const bool fastpath, std::string& msg) {
json root;
root["type"] = command_t::DELETE_DATA_REQUEST;
root["id"] = std::vector<ObjectID>{id};
root["force"] = force;
root["deep"] = deep;
root["fastpath"] = fastpath;
root["memory_trim"] = memory_trim;

encode_msg(root, msg);
}

void WriteDelDataRequest(const std::vector<ObjectID>& ids, const bool force,
const bool deep, const bool fastpath,
const bool deep, const bool memory_trim, const bool fastpath,
std::string& msg) {
json root;
root["type"] = command_t::DELETE_DATA_REQUEST;
root["id"] = ids;
root["force"] = force;
root["deep"] = deep;
root["fastpath"] = fastpath;
root["memory_trim"] = memory_trim;

encode_msg(root, msg);
}

Status ReadDelDataRequest(const json& root, std::vector<ObjectID>& ids,
bool& force, bool& deep, bool& fastpath) {
bool& force, bool& deep, bool &memory_trim, bool& fastpath) {
CHECK_IPC_ERROR(root, command_t::DELETE_DATA_REQUEST);
root["id"].get_to(ids);
force = root.value("force", false);
deep = root.value("deep", false);
fastpath = root.value("fastpath", false);
memory_trim = root.value("memory_trim", false);
return Status::OK();
}

Expand Down
6 changes: 3 additions & 3 deletions src/common/util/protocols.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,14 @@ Status ReadListDataRequest(const json& root, std::string& pattern, bool& regex,
size_t& limit);

void WriteDelDataRequest(const ObjectID id, const bool force, const bool deep,
const bool fastpath, std::string& msg);
const bool memory_trim, const bool fastpath, std::string& msg);

void WriteDelDataRequest(const std::vector<ObjectID>& id, const bool force,
const bool deep, const bool fastpath,
const bool deep, const bool memory_trim, const bool fastpath,
std::string& msg);

Status ReadDelDataRequest(const json& root, std::vector<ObjectID>& id,
bool& force, bool& deep, bool& fastpath);
bool& force, bool& deep, bool &memory_trim, bool& fastpath);

void WriteDelDataReply(std::string& msg);

Expand Down

0 comments on commit fef0b1e

Please sign in to comment.