git-hulk commented on code in PR #881:
URL: https://github.com/apache/incubator-kvrocks/pull/881#discussion_r973531504
##########
src/redis_cmd.cc:
##########
@@ -4132,6 +4132,52 @@ class CommandEcho : public Commander {
}
};
+class CommandHello final : public Commander {
+public:
+ Status Execute(Server *svr, Connection *conn, std::string *output) override {
+ std::cout << "Execute is called" << std::endl;
+ if (args_.size() == 2) {
+ int64_t protocol;
+ try {
+ protocol = std::stoll(args_[1]);
+ } catch (std::exception& e) {
+ // std::invalid_argument or std::out_of_range
+ *output = Redis::Error("Protocol version is not an integer or out of
range");
+ return Status::OK();
+ }
+
+ // In redis, it will check protocol < 2 or protocol > 3,
+ // but kvrocks only supports REPL2 by now.
+ if (protocol != 2) {
+ *output = Redis::Error("-NOPROTO unsupported protocol version");
+ return Status::OK();
+ }
+ }
+
+ // TODO(mapleFU): do we need to implement auth and setname?
Review Comment:
Yes, setname can use
[Connection::SetName](https://github.com/apache/incubator-kvrocks/blob/40132067bc7bb696f96675e8a396f0473321a454/src/redis_connection.h#L80)
--
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]