ltagliamonte-dd commented on code in PR #2845:
URL: https://github.com/apache/kvrocks/pull/2845#discussion_r2044400438


##########
src/commands/cmd_server.cc:
##########
@@ -1370,6 +1370,49 @@ class CommandPollUpdates : public Commander {
   Format format_ = Format::Raw;
 };
 
+class CommandSST : public Commander {
+ public:
+  Status Parse(const std::vector<std::string> &args) override {
+    if (args.size() < 3) {
+      return {Status::RedisParseErr, errWrongNumOfArguments};
+    }
+    CommandParser parser(args, 1);
+    std::string cmd = GET_OR_RET(parser.TakeStr());
+    if (!util::EqualICase(cmd, "load")) {
+      return {Status::RedisParseErr, "unknown subcommand:" + args[1]};
+    }
+    folder_ = GET_OR_RET(parser.TakeStr());
+    // Parse optional movefiles flag
+    while (parser.Good()) {
+      if (parser.EatEqICase("movefiles")) {
+        std::string move_files = GET_OR_RET(parser.TakeStr());
+        if (util::EqualICase(move_files, "yes")) {
+          ingest_options_.move_files = true;
+        } else if (util::EqualICase(move_files, "no")) {
+          ingest_options_.move_files = false;
+        } else {
+          return {Status::RedisParseErr, "movefiles value must be 'yes' or 
'no'"};
+        }
+      } else {
+        return {Status::RedisParseErr, "unknown option: " + 
parser.TakeStr().GetValue()};
+      }
+    }
+    return Commander::Parse(args);
+  }
+
+  Status Execute([[maybe_unused]] engine::Context &ctx, Server *srv, 
[[maybe_unused]] Connection *conn,
+                 std::string *output) override {

Review Comment:
   this check is perfomed in 
https://github.com/ltagliamonte-dd/kvrocks/blob/sideloading/src/storage/storage.cc#L773-L776
   since i have already access to _config.



##########
src/commands/cmd_server.cc:
##########
@@ -1370,6 +1370,49 @@ class CommandPollUpdates : public Commander {
   Format format_ = Format::Raw;
 };
 
+class CommandSST : public Commander {
+ public:
+  Status Parse(const std::vector<std::string> &args) override {
+    if (args.size() < 3) {
+      return {Status::RedisParseErr, errWrongNumOfArguments};
+    }
+    CommandParser parser(args, 1);
+    std::string cmd = GET_OR_RET(parser.TakeStr());
+    if (!util::EqualICase(cmd, "load")) {
+      return {Status::RedisParseErr, "unknown subcommand:" + args[1]};
+    }
+    folder_ = GET_OR_RET(parser.TakeStr());
+    // Parse optional movefiles flag
+    while (parser.Good()) {
+      if (parser.EatEqICase("movefiles")) {
+        std::string move_files = GET_OR_RET(parser.TakeStr());
+        if (util::EqualICase(move_files, "yes")) {
+          ingest_options_.move_files = true;
+        } else if (util::EqualICase(move_files, "no")) {
+          ingest_options_.move_files = false;
+        } else {
+          return {Status::RedisParseErr, "movefiles value must be 'yes' or 
'no'"};
+        }
+      } else {
+        return {Status::RedisParseErr, "unknown option: " + 
parser.TakeStr().GetValue()};
+      }
+    }
+    return Commander::Parse(args);
+  }
+
+  Status Execute([[maybe_unused]] engine::Context &ctx, Server *srv, 
[[maybe_unused]] Connection *conn,
+                 std::string *output) override {

Review Comment:
   @git-hulk how to check `The instance has any replicas or is in replica 
mode.`?



##########
src/commands/cmd_server.cc:
##########
@@ -1370,6 +1370,49 @@ class CommandPollUpdates : public Commander {
   Format format_ = Format::Raw;
 };
 
+class CommandSST : public Commander {
+ public:
+  Status Parse(const std::vector<std::string> &args) override {
+    if (args.size() < 3) {
+      return {Status::RedisParseErr, errWrongNumOfArguments};
+    }
+    CommandParser parser(args, 1);
+    std::string cmd = GET_OR_RET(parser.TakeStr());
+    if (!util::EqualICase(cmd, "load")) {
+      return {Status::RedisParseErr, "unknown subcommand:" + args[1]};
+    }
+    folder_ = GET_OR_RET(parser.TakeStr());
+    // Parse optional movefiles flag
+    while (parser.Good()) {
+      if (parser.EatEqICase("movefiles")) {
+        std::string move_files = GET_OR_RET(parser.TakeStr());
+        if (util::EqualICase(move_files, "yes")) {
+          ingest_options_.move_files = true;
+        } else if (util::EqualICase(move_files, "no")) {
+          ingest_options_.move_files = false;
+        } else {
+          return {Status::RedisParseErr, "movefiles value must be 'yes' or 
'no'"};
+        }
+      } else {
+        return {Status::RedisParseErr, "unknown option: " + 
parser.TakeStr().GetValue()};
+      }
+    }
+    return Commander::Parse(args);
+  }
+
+  Status Execute([[maybe_unused]] engine::Context &ctx, Server *srv, 
[[maybe_unused]] Connection *conn,
+                 std::string *output) override {

Review Comment:
   addressed via 66545dada56d37b1090d00e5244723cb6e1ec8c8



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