You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2025/04/04 05:10:25 UTC

Re: [PR] feat: add deleterange command and test [kvrocks]

mapleFU commented on code in PR #2839:
URL: https://github.com/apache/kvrocks/pull/2839#discussion_r2028093100


##########
src/storage/redis_db.h:
##########
@@ -111,6 +111,7 @@ class Database {
   [[nodiscard]] rocksdb::Status Expire(engine::Context &ctx, const Slice &user_key, uint64_t timestamp);
   [[nodiscard]] rocksdb::Status Del(engine::Context &ctx, const Slice &user_key);
   [[nodiscard]] rocksdb::Status MDel(engine::Context &ctx, const std::vector<Slice> &keys, uint64_t *deleted_cnt);
+  [[nodiscard]] rocksdb::Status DeleteRange(engine::Context &ctx, const Slice &start, const Slice &end);

Review Comment:
   ```suggestion
     [[nodiscard]] rocksdb::Status DeleteRange(engine::Context &ctx, Slice start, Slice end);
   ```



##########
src/commands/cmd_key.cc:
##########
@@ -356,6 +357,33 @@ class CommandDel : public Commander {
   }
 };
 
+class CommandDeleteRange : public Commander {
+  Status Parse(const std::vector<std::string> &args) override {
+    if (args.size() != 3) {
+      if (args.size() != 2) {
+        return {Status::RedisParseErr, errInvalidSyntax};
+      }
+      if (args[1].find('*') != args[1].size() - 1) {
+        return {Status::RedisParseErr, errInvalidSyntax};
+      }
+      args_[1] = args[1].substr(0, args[1].size() - 1);

Review Comment:
   So this is a regex rule?



-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org