PragmaTwice commented on code in PR #2236:
URL: https://github.com/apache/kvrocks/pull/2236#discussion_r1562365781


##########
src/commands/cmd_server.cc:
##########
@@ -823,16 +823,33 @@ class CommandScan : public CommandScanBase {
     if (args.size() % 2 != 0) {
       return {Status::RedisParseErr, errWrongNumOfArguments};
     }
-
-    ParseCursor(args[1]);
-    if (args.size() >= 4) {
-      ScanParameters parameters;
-      Status s = ParseScanParameters(args, &parameters);
-      FillScanAttributes(&parameters);
-      if (!s.IsOK()) {
-        return s;
+    CommandParser parser(args, 0);
+    while (parser.Good()) {
+      if (parser.EatEqICase("scan")) {
+        ParseCursor(GET_OR_RET(parser.TakeStr()));
+      } else if (parser.EatEqICase("match")) {
+        prefix_ = GET_OR_RET(parser.TakeStr());
+        if (!prefix_.empty() && prefix_[prefix_.size() - 1] == '*') {
+          prefix_ = prefix_.substr(0, prefix_.size() - 1);
+        } else {
+          return {Status::RedisParseErr, "only keys prefix match was 
supported"};
+        }
+      } else if (parser.EatEqICase("count")) {
+        auto parse_result = ParseInt<int>(GET_OR_RET(parser.TakeStr()), 10);

Review Comment:
   Please use `parser.TakeInt()`



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