PragmaTwice commented on code in PR #1468:
URL:
https://github.com/apache/incubator-kvrocks/pull/1468#discussion_r1204129171
##########
src/commands/cmd_zset.cc:
##########
@@ -266,6 +269,80 @@ class CommandZPopMax : public CommandZPop {
CommandZPopMax() : CommandZPop(false) {}
};
+class CommandZMPop : public Commander {
+ public:
+ CommandZMPop() = default;
+
+ Status Parse(const std::vector<std::string> &args) override {
+ CommandParser parser(args, 1);
+ if (auto parse_int = parser.TakeInt<int>(NumericRange<int>{1,
std::numeric_limits<int>::max()}); !parse_int) {
+ return parse_int.ToStatus();
+ } else {
+ numkeys_ = *parse_int;
+ }
+ for (int i = 0; i < numkeys_; ++i) {
+ if (!parser.Good()) {
+ return parser.InvalidSyntax();
+ }
+ keys_.emplace_back(*parser.TakeStr());
+ }
+ bool has_min_flag = false;
+
+ while (parser.Good()) {
+ if (parser.EatEqICase("min")) {
+ min_ = true;
+ has_min_flag = true;
+ } else if (parser.EatEqICase("max")) {
+ min_ = false;
+ has_min_flag = true;
+ } else if (parser.EatEqICase("count")) {
+ auto parse_int = parser.TakeInt<int>(NumericRange<int>{1,
std::numeric_limits<int>::max()});
+ if (!parse_int) {
+ return parse_int.ToStatus();
+ }
+ count_ = *parse_int;
Review Comment:
ditto
--
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]