This is an automated email from the ASF dual-hosted git repository.
twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 2f520f91 chore(cmd): add comments for command flags (#2641)
2f520f91 is described below
commit 2f520f918cdae701934f1b88fa49072a250389eb
Author: Twice <[email protected]>
AuthorDate: Sun Nov 3 12:26:11 2024 +0800
chore(cmd): add comments for command flags (#2641)
---
src/commands/cmd_cluster.cc | 11 +++++------
src/commands/commander.h | 37 ++++++++++++++++++++++++-------------
2 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/src/commands/cmd_cluster.cc b/src/commands/cmd_cluster.cc
index 4a6d5dbe..f8e63728 100644
--- a/src/commands/cmd_cluster.cc
+++ b/src/commands/cmd_cluster.cc
@@ -357,11 +357,10 @@ class CommandAsking : public Commander {
}
};
-REDIS_REGISTER_COMMANDS(Cluster,
- MakeCmdAttr<CommandCluster>("cluster", -2, "cluster
no-script", NO_KEY, GenerateClusterFlag),
- MakeCmdAttr<CommandClusterX>("clusterx", -2, "cluster
no-script", NO_KEY, GenerateClusterFlag),
- MakeCmdAttr<CommandReadOnly>("readonly", 1, "cluster
no-multi", NO_KEY),
- MakeCmdAttr<CommandReadWrite>("readwrite", 1, "cluster
no-multi", NO_KEY),
- MakeCmdAttr<CommandAsking>("asking", 1, "cluster",
NO_KEY), )
+REDIS_REGISTER_COMMANDS(Cluster, MakeCmdAttr<CommandCluster>("cluster", -2,
"no-script", NO_KEY, GenerateClusterFlag),
+ MakeCmdAttr<CommandClusterX>("clusterx", -2,
"no-script", NO_KEY, GenerateClusterFlag),
+ MakeCmdAttr<CommandReadOnly>("readonly", 1,
"no-multi", NO_KEY),
+ MakeCmdAttr<CommandReadWrite>("readwrite", 1,
"no-multi", NO_KEY),
+ MakeCmdAttr<CommandAsking>("asking", 1, "", NO_KEY), )
} // namespace redis
diff --git a/src/commands/commander.h b/src/commands/commander.h
index 066c4ce8..b1d0a049 100644
--- a/src/commands/commander.h
+++ b/src/commands/commander.h
@@ -56,17 +56,30 @@ class Connection;
struct CommandAttributes;
enum CommandFlags : uint64_t {
- kCmdWrite = 1ULL << 0, // "write" flag
- kCmdReadOnly = 1ULL << 1, // "read-only" flag
- kCmdLoading = 1ULL << 5, // "ok-loading" flag
- kCmdEndMulti = 1ULL << 6, // "multi" flag, for ending a MULTI scope
- kCmdExclusive = 1ULL << 7, // "exclusive" flag
- kCmdNoMulti = 1ULL << 8, // "no-multi" flag
- kCmdNoScript = 1ULL << 9, // "no-script" flag
- kCmdCluster = 1ULL << 11, // "cluster" flag
- kCmdNoDBSizeCheck = 1ULL << 12, // "no-dbsize-check" flag
- kCmdSlow = 1ULL << 13, // "slow" flag
- kCmdBlocking = 1ULL << 14, // "blocking" flag
+ // "write" flag, for any command that performs rocksdb writing ops
+ kCmdWrite = 1ULL << 0,
+ // "read-only" flag, for any command that performs rocksdb reading ops
+ // and doesn't perform rocksdb writing ops
+ kCmdReadOnly = 1ULL << 1,
+ // "ok-loading" flag, for any command that can be executed while
+ // the db is in loading phase
+ kCmdLoading = 1ULL << 5,
+ // "multi" flag, for commands that can end a MULTI scope
+ kCmdEndMulti = 1ULL << 6,
+ // "exclusive" flag, for commands that should be executed execlusive globally
+ kCmdExclusive = 1ULL << 7,
+ // "no-multi" flag, for commands that cannot be executed in MULTI scope
+ kCmdNoMulti = 1ULL << 8,
+ // "no-script" flag, for commands that cannot be executed in scripting
+ kCmdNoScript = 1ULL << 9,
+ // "no-dbsize-check" flag, for commands that can ignore the db size checking
+ kCmdNoDBSizeCheck = 1ULL << 12,
+ // "slow" flag, for commands that run slowly,
+ // usually with a non-constant number of rocksdb ops
+ kCmdSlow = 1ULL << 13,
+ // "blocking" flag, for commands that don't perform db ops immediately,
+ // but block and wait for some event to happen before performing db ops
+ kCmdBlocking = 1ULL << 14,
};
enum class CommandCategory : uint8_t {
@@ -309,8 +322,6 @@ inline uint64_t ParseCommandFlags(const std::string
&description, const std::str
flags |= kCmdNoMulti;
else if (flag == "no-script")
flags |= kCmdNoScript;
- else if (flag == "cluster")
- flags |= kCmdCluster;
else if (flag == "no-dbsize-check")
flags |= kCmdNoDBSizeCheck;
else if (flag == "slow")