From fb34cd5b113b0176dba06e4ddbbefedd390791c4 Mon Sep 17 00:00:00 2001 From: Michal Jarzabek Date: Mon, 8 Aug 2016 23:03:40 +0100 Subject: [PATCH] mon/ConfigKeyService: pass strings by const ref Signed-off-by: Michal Jarzabek --- src/mon/ConfigKeyService.cc | 8 ++++---- src/mon/ConfigKeyService.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mon/ConfigKeyService.cc b/src/mon/ConfigKeyService.cc index 2d787897746..df180b7a636 100644 --- a/src/mon/ConfigKeyService.cc +++ b/src/mon/ConfigKeyService.cc @@ -33,7 +33,7 @@ static ostream& _prefix(std::ostream *_dout, const Monitor *mon, const string ConfigKeyService::STORE_PREFIX = "mon_config_key"; -int ConfigKeyService::store_get(string key, bufferlist &bl) +int ConfigKeyService::store_get(const string &key, bufferlist &bl) { return mon->store->get(STORE_PREFIX, key, bl); } @@ -43,7 +43,7 @@ void ConfigKeyService::get_store_prefixes(set& s) s.insert(STORE_PREFIX); } -void ConfigKeyService::store_put(string key, bufferlist &bl, Context *cb) +void ConfigKeyService::store_put(const string &key, bufferlist &bl, Context *cb) { MonitorDBStore::TransactionRef t = paxos->get_pending_transaction(); t->put(STORE_PREFIX, key, bl); @@ -52,7 +52,7 @@ void ConfigKeyService::store_put(string key, bufferlist &bl, Context *cb) paxos->trigger_propose(); } -void ConfigKeyService::store_delete(string key, Context *cb) +void ConfigKeyService::store_delete(const string &key, Context *cb) { MonitorDBStore::TransactionRef t = paxos->get_pending_transaction(); t->erase(STORE_PREFIX, key); @@ -61,7 +61,7 @@ void ConfigKeyService::store_delete(string key, Context *cb) paxos->trigger_propose(); } -bool ConfigKeyService::store_exists(string key) +bool ConfigKeyService::store_exists(const string &key) { return mon->store->exists(STORE_PREFIX, key); } diff --git a/src/mon/ConfigKeyService.h b/src/mon/ConfigKeyService.h index e03b92e27db..4d2b072fe62 100644 --- a/src/mon/ConfigKeyService.h +++ b/src/mon/ConfigKeyService.h @@ -26,11 +26,11 @@ class ConfigKeyService : public QuorumService { Paxos *paxos; - int store_get(string key, bufferlist &bl); - void store_put(string key, bufferlist &bl, Context *cb = NULL); - void store_delete(string key, Context *cb = NULL); + int store_get(const string &key, bufferlist &bl); + void store_put(const string &key, bufferlist &bl, Context *cb = NULL); + void store_delete(const string &key, Context *cb = NULL); void store_list(stringstream &ss); - bool store_exists(string key); + bool store_exists(const string &key); static const string STORE_PREFIX; -- 2.39.5