Remove cmd name from args (#1057)

chore: remove cmd name from the list of arguments

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Co-authored-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Vladislav 2023-04-10 14:14:52 +03:00 committed by GitHub
parent 8600eacdc4
commit a12ddfe108
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 564 additions and 573 deletions

View file

@ -61,24 +61,24 @@ struct KeyIndex {
unsigned end; // does not include this index (open limit).
unsigned step; // 1 for commands like mget. 2 for commands like mset.
// if index is non-zero then adds another key index (usually 1).
// if index is non-zero then adds another key index (usually 0).
// relevant for for commands like ZUNIONSTORE/ZINTERSTORE for destination key.
unsigned bonus = 0;
std::optional<uint16_t> bonus{};
static KeyIndex Empty() {
return KeyIndex{0, 0, 0, 0};
return KeyIndex{0, 0, 0, std::nullopt};
}
static KeyIndex Range(unsigned start, unsigned end, unsigned step = 1) {
return KeyIndex{start, end, step, 0};
return KeyIndex{start, end, step, std::nullopt};
}
bool HasSingleKey() const {
return bonus == 0 && (start + step >= end);
return !bonus && (start + step >= end);
}
unsigned num_args() const {
return end - start + (bonus > 0);
return end - start + bool(bonus);
}
};