You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "zncleon (via GitHub)" <gi...@apache.org> on 2023/09/16 04:32:38 UTC
[GitHub] [kvrocks] zncleon commented on a diff in pull request #1758: Add the support of the BF.MADD command
zncleon commented on code in PR #1758:
URL: https://github.com/apache/kvrocks/pull/1758#discussion_r1327901814
##########
src/commands/cmd_bloom_filter.cc:
##########
@@ -95,11 +95,46 @@ class CommandBFAdd : public Commander {
auto s = bloom_db.Add(args_[1], args_[2], &ret);
if (!s.ok()) return {Status::RedisExecErr, s.ToString()};
- *output = redis::Integer(ret);
+ if (ret == -1) {
+ *output = redis::Error("ERR nonscaling filter is full");
+ } else {
+ *output = redis::Integer(ret);
+ }
return Status::OK();
}
};
+class CommandBFMAdd : public Commander {
+ public:
+ Status Parse(const std::vector<std::string> &args) override {
+ items_.reserve(args_.size() - 2);
+ for (size_t i = 2; i < args_.size(); ++i) {
+ items_.emplace_back(args_[i]);
+ }
+ return Commander::Parse(args);
+ }
+
+ Status Execute(Server *svr, Connection *conn, std::string *output) override {
+ redis::BloomChain bloom_db(svr->storage, conn->GetNamespace());
+ std::vector<int> rets(items_.size(), 0);
Review Comment:
Sure, I think it's necessary to change it(and `Exists`) to the explicit type and name.
--
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