PragmaTwice commented on code in PR #2272:
URL: https://github.com/apache/kvrocks/pull/2272#discussion_r1586338963
##########
src/cluster/cluster.cc:
##########
@@ -53,10 +55,10 @@ Cluster::Cluster(Server *srv, std::vector<std::string>
binds, int port)
// cluster data, so these commands should be executed exclusively, and
ReadWriteLock
// also can guarantee accessing data is safe.
bool Cluster::SubCommandIsExecExclusive(const std::string &subcommand) {
- for (auto v : {"setnodes", "setnodeid", "setslot", "import", "reset"}) {
- if (util::EqualICase(v, subcommand)) return true;
- }
- return false;
+ std::array subcommands = {"setnodes", "setnodeid", "setslot", "import",
"reset"};
+
+ return std::any_of(std::begin(subcommands), std::end(subcommands),
+ [&subcommand](const std::string &val) { return
util::EqualICase(val, subcommand); });
Review Comment:
The parameter type should be `string_view` or `auto`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]