From d30e4c2318d81357b6b1e6755d820259d4069d32 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 2 Mar 2021 17:00:51 +0800 Subject: [PATCH] crimson/mon: pass a string to Client::run_command() as the reason why MMonCommand uses a vector is but for legacy reasons, there is no need to expose this via the interface. Signed-off-by: Kefu Chai --- src/crimson/mon/MonClient.cc | 8 ++++---- src/crimson/mon/MonClient.h | 4 ++-- src/crimson/osd/osd.cc | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index e72f45bb0e715..8c7326f3e35ac 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -993,14 +993,14 @@ void Client::_finish_auth(const entity_addr_t& peer) } Client::command_result_t -Client::run_command(const std::vector& cmd, - const bufferlist& bl) +Client::run_command(std::string&& cmd, + bufferlist&& bl) { auto m = make_message(monmap.fsid); auto tid = ++last_mon_command_id; m->set_tid(tid); - m->cmd = cmd; - m->set_data(bl); + m->cmd = {std::move(cmd)}; + m->set_data(std::move(bl)); auto& req = mon_commands[tid]; return send_message(m).then([&req] { return req.get_future(); diff --git a/src/crimson/mon/MonClient.h b/src/crimson/mon/MonClient.h index 430260c317081..8c2447b5e687f 100644 --- a/src/crimson/mon/MonClient.h +++ b/src/crimson/mon/MonClient.h @@ -82,8 +82,8 @@ public: return monmap.fsid; } get_version_t get_version(const std::string& map); - command_result_t run_command(const std::vector& cmd, - const bufferlist& bl); + command_result_t run_command(std::string&& cmd, + bufferlist&& bl); seastar::future<> send_message(MessageRef); bool sub_want(const std::string& what, version_t start, unsigned flags); void sub_got(const std::string& what, version_t have); diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index 521cb9ba3bb18..a4a6eda4331ab 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -404,7 +404,7 @@ seastar::future<> OSD::_add_me_to_crush() "weight": {:.4f}, "args": [{}] }})", whoami, weight, loc); - return monc->run_command({cmd}, {}); + return monc->run_command(std::move(cmd), {}); }).then([](auto&& command_result) { [[maybe_unused]] auto [code, message, out] = std::move(command_result); if (code) { -- 2.39.5