Skip to content

Commit

Permalink
Merge branch 'unstable' into unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice authored Nov 3, 2024
2 parents b8227a1 + 2f520f9 commit 8b8f1ca
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
11 changes: 5 additions & 6 deletions src/commands/cmd_cluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
37 changes: 24 additions & 13 deletions src/commands/commander.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 8b8f1ca

Please sign in to comment.