Skip to content

Commit

Permalink
Support ASKING command
Browse files Browse the repository at this point in the history
  • Loading branch information
jjz921024 committed Apr 26, 2024
1 parent ae5784d commit aa1490d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/commands/cmd_cluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,19 @@ class CommandReadWrite : public Commander {
}
};

class CommandAsking : public Commander {
public:
Status Execute(Server *srv, Connection *conn, std::string *output) override {
conn->EnableFlag(redis::Connection::kAsking);
*output = redis::SimpleString("OK");
return Status::OK();
}
};

REDIS_REGISTER_COMMANDS(MakeCmdAttr<CommandCluster>("cluster", -2, "cluster no-script", 0, 0, 0, GenerateClusterFlag),
MakeCmdAttr<CommandClusterX>("clusterx", -2, "cluster no-script", 0, 0, 0, GenerateClusterFlag),
MakeCmdAttr<CommandReadOnly>("readonly", 1, "cluster no-multi", 0, 0, 0),
MakeCmdAttr<CommandReadWrite>("readwrite", 1, "cluster no-multi", 0, 0, 0), )
MakeCmdAttr<CommandReadWrite>("readwrite", 1, "cluster no-multi", 0, 0, 0),
MakeCmdAttr<CommandAsking>("asking", 1, "cluster", 0, 0, 0), )

} // namespace redis
1 change: 1 addition & 0 deletions src/server/redis_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Connection : public EvbufCallbackBase<Connection> {
kCloseAsync = 1 << 7,
kMultiExec = 1 << 8,
kReadOnly = 1 << 9,
kAsking = 1 << 10,
};

explicit Connection(bufferevent *bev, Worker *owner);
Expand Down

0 comments on commit aa1490d

Please sign in to comment.