git-hulk commented on code in PR #2225:
URL: https://github.com/apache/kvrocks/pull/2225#discussion_r1554625945


##########
src/storage/redis_db.cc:
##########
@@ -721,6 +721,51 @@ rocksdb::Status Database::Rename(const std::string &key, 
const std::string &new_
 
   if (key == new_key) return rocksdb::Status::OK();
 
+  return moveInternal(ns_key, new_ns_key, type);
+}
+
+rocksdb::Status Database::Move(const std::string &key, const std::string 
&new_ns, bool *ret) {

Review Comment:
   Seems the only difference between the RENAME and MOVE is how to construct 
its new key. The rename command requires the same namespace and a different 
key, and the move command requires a different namespace but the same key. So I 
think we need to move the construction of the new key out of Database::Rename, 
and then both of rename/move can share the same implementation.



##########
src/commands/cmd_key.cc:
##########
@@ -64,6 +64,41 @@ class CommandMove : public Commander {
   }
 };
 
+class CommandMoveX : public Commander {
+ public:
+  Status Execute(Server *srv, Connection *conn, std::string *output) override {
+    std::string &key = args_[1], &ns = args_[2], &token = args_[3];
+
+    redis::Database redis(srv->storage, conn->GetNamespace());

Review Comment:
   Is it better to move the old AuthenticateUser as a member function and set 
the connection namespace outside? so that we can reuse the authenticate code 
block:
   
   ```
   AuthResult Server::AuthenticateUser(const std::string &user_password, 
std::string *ns);
   ```



-- 
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]

Reply via email to