-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core: Add support for sending multi-slot JSON.MSET and JSON.MGET commands #2587
Conversation
d1f88da
to
b56b5ef
Compare
Thanks |
/// Represents the pattern of argument structures in multi-slot commands, | ||
/// defining how the arguments are organized in the command. | ||
#[derive(Debug, Clone, PartialEq)] | ||
pub enum MultiSlotArgPattern { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the idea is to cover all options here? e.g. if I look at HSET
, which has HSET KEY field value [field value..]
are we going to create a new enumerator here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HSET has a single key, so it wont be a multi-slot command. But, in general, yes - if there is going to be a command with a new pattern that we can support it in a multi-slot option, we will add it here
a7a336f
to
8a25a60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Can't post an approval, because I can't assess the rust code part.
java/client/src/main/java/glide/api/commands/GenericBaseCommands.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/commands/StringBaseCommands.java
Outdated
Show resolved
Hide resolved
196b189
to
d94e7ca
Compare
5809f11
to
d0b7b59
Compare
…ands Signed-off-by: barshaul <barshaul@amazon.com>
…NK, EXISTS, TOUCH, WATCH Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
9d38afb
to
d05854b
Compare
…ype Signed-off-by: EdricCua <ecuartero@google.com>
…ype. Signed-off-by: EdricCua <ecuartero@google.com>
…ype. Signed-off-by: EdricCua <ecuartero@google.com>
Description
This PR adds support for handling
JSON.MSET
andJSON.MGET
commands with multi-slot keys, expanding the argument patterns that are currently supported. Prior to this PR, the system only supported two argument patterns for MGET and MSET: keys only, and key value pairs. This update introduces support for two additional patterns:Keys and Path
: Relevant for theJSON.MGET
command, which follows the formatJSON.MGET key1 key2 key3 path
.Key Path Value Triples
: Relevant for theJSON.MSET
command, which follows the formatJSON.MSET key1 path1 value1 key2 path2 value2
.All patterns are now being represented with the
MultiSlotArgPattern
enum.Multi-Slot Command Handling:
There are two main parts in handling multi-slot commands:
Command Splitting:
multi_shard
function is responsible for splitting commands into sub-commands based on the slots each key belongs to. This PR enables the correct splitting ofJSON.MGET
andJSON.MSET
commands based on the newly added argument patterns (KeysAndPath
andKeyPathValueTriples
).Response Aggregation:
MGET
andJSON.MGET
): Combines all sub-command responses into a single array, maintaining the order of commands in the original request.MSET
andJSON.MSET
): ReturnsOK
if all sub-commands succeed; otherwise, returns the first encountered error.Although MSET and JSON.MSET currently don’t use combined array responses in Glide, this PR adds support for combining results into a single array for these commands too. This enhancement prepares for a future feature where responses can return an array of OK and Error results, allowing the operation to continue without failing entirely if a request for a single slot fails.
This extension enables enhanced multi-slot handling for
JSON.MGET
andJSON.MSET
, improving the client's ability to manage complex, multi-slot commands and aggregate responses accurately.Issue link
This Pull Request is linked to issue (URL): closes #2455
Checklist
Before submitting the PR make sure the following are checked: