-
Notifications
You must be signed in to change notification settings - Fork 53
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
Java: Add FUNCTION LIST
command.
#1452
Java: Add FUNCTION LIST
command.
#1452
Conversation
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
* Add `FUNCTION LIST` command. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> * Tests for the God of Tests. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> * I HATE YOU SPOTLESS Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> * Ruuuuuuuuuuuuuuuuuust Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> * Add `@since`. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> * Update examples. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> * Clean up value conversion code. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> * Address PR comments. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> --------- Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
|
||
/** | ||
* Returns information about the functions and libraries.<br> | ||
* The command will be routed to all primary nodes. |
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.
Just wanted to double check, are we sure this is correct? Unlike FUNCTION FLUSH and FUNCTION LOAD, which have an ALL_SHARDS request policy (see here), FUNCTION LIST does not have any request policy (see here)
On a related note, unlike FUNCTION LOAD and FUNCTION FLUSH, this command is not in cluster_routing.rs, I'm assuming we'll have to add it?
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.
Oh right, going to add it
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.
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.
please close this
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.
Updated & closed.
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.
I think we still need to update redis-rs#cluster_routing.rs to map this command to RANDOM, since the default is FirstKey
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.
Reopened
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.
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsCommands.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
@@ -5,7 +5,7 @@ use redis::{ | |||
cluster_routing::Routable, from_owned_redis_value, Cmd, ErrorKind, RedisResult, Value, | |||
}; | |||
|
|||
#[derive(Clone, Copy)] | |||
#[derive(Clone, Copy, Debug)] |
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.
Why?
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.
It is required for debug logging. I decided to keep it.
3) "engine" | ||
4) "LUA" | ||
5) "functions" | ||
6) 1) 1) "name" |
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.
is this a set?
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.
flags
is a set
|
||
/** | ||
* Returns information about the functions and libraries.<br> | ||
* The command will be routed to all primary nodes. |
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.
please close this
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
java/integTest/src/test/java/glide/TransactionTestUtilities.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/models/BaseTransaction.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
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.
Approved with some minor comments on the Rust side, though, I skimmed through the Java side briefly too.
} | ||
} | ||
|
||
/// Similar to [`convert_array_to_map`], but converts a map to a map. |
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.
Kind of confusingly worded. I think this is a little more clear:
/// Similar to [`convert_array_to_map`], but converts a map to a map. | |
/// Similar to [`convert_array_to_map`], but converts an array of value pairs to a map. |
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.
Input argument is always a map
https://github.com/amazon-contributing/redis-rs/blob/e28a97877fc353497b35a0cd033bf47cb199b47e/redis/src/types.rs#L325
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.
okay, but saying "map to a map" sounds like you're just running the identity function (which you are not). What does this actually do?
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.
It converts keys and values inside the map. So input is a map and output is a map too.
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.
okay, I feel like the comment could describe it as such. Otherwise, the function looks like it just takes a map and returns it, based on the description. That being said, if you really want to, you can leave the comment as is. I don't think it'll matter much in the long run for such a minor documentation nit.
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.
Updated, thank you.
java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsClusterCommands.java
Outdated
Show resolved
Hide resolved
|
||
/** | ||
* Returns information about the functions and libraries.<br> | ||
* The command will be routed to all primary nodes. |
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.
I think we still need to update redis-rs#cluster_routing.rs to map this command to RANDOM, since the default is FirstKey
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
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 but we will need to merge the change to redis-rs first
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
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.
This PR is too large to be properly reviewed, and there are some parts which can be easily moved to different PRs - for example the value conversion logic.
You can have PRs that are being rebased over others, but we need to have smaller PRs in order to make sure we're not missing anything.
valkey-io#1452. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Please see #1489 |
Suspended: waiting for #1489 and for amazon-contributing/redis-rs#148 |
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Review addressed in #1489 which is already merged
* Add `FUNCTION LIST` command. (#277) Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>
* Add `FUNCTION LIST` command. (#277) Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>
Issue #, if available:
N/A
Description of changes:
https://redis.io/docs/latest/commands/function-list/
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Some highlights in this PR:
value_conversion.rs
)ScriptingAndFunctions*Commands.java
)RedisClient.java
&RedisClusterClient.java
)BaseClient.java
)BaseTransaction.java
)FunctionListOptions.java
)java/client/src/test/...
)TransactionTestUtilities.java
)CommandTests.java
)TestUtilities.java
)Some details on how response conversion works: