-
Notifications
You must be signed in to change notification settings - Fork 70
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 transaction commands #895
Java: Add transaction commands #895
Conversation
java/client/src/main/java/glide/api/models/BaseTransaction.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/models/BaseTransaction.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/models/configuration/RequestRoutingConfiguration.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/models/configuration/RequestRoutingConfiguration.java
Outdated
Show resolved
Hide resolved
java/client/src/test/java/glide/managers/CommandManagerTest.java
Outdated
Show resolved
Hide resolved
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 add
- IT
- protection for custom command vs empty args input
java/client/src/main/java/glide/api/commands/ClusterBaseCommands.java
Outdated
Show resolved
Hide resolved
@Getter | ||
public abstract class BaseTransaction<T extends BaseTransaction<T>> { | ||
/** Command class to send a single request to Redis. */ | ||
protected final Transaction.Builder transactionBuilder = Transaction.newBuilder(); |
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.
You're using here protobuf's Transaction
, and it reduces legibility. Please use ProtobufTransaction, or a similar name.
* @see <a href="https://redis.io/commands/set/">redis.io</a> | ||
*/ | ||
@Builder | ||
public final class SetOptions { |
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 will be updated from changes in #894.
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, assuming the set/info specific code is removed.
* @see <a href="https://redis.io/commands/set/">redis.io</a> | ||
*/ | ||
@Builder | ||
public final class SetOptions { |
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.
can this be remove from this PR?
You can add it after the set PR is merged
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 was actually intending to merge this after the set() command PR. There's no rush on this one.
* @see <a href="https://redis.io/commands/info/">redis.io</a> | ||
*/ | ||
@Builder | ||
public final class InfoOptions { |
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.
can this be removed from this PR? you can add it after the info command PR is merged.
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 was actually intending to merge this after the info() command PR. There's no rush on this one.
b5fc521
to
c98feb2
Compare
java/client/src/main/java/glide/api/commands/GenericClusterCommands.java
Outdated
Show resolved
Hide resolved
clusterClient.exec(transaction, RANDOM).get(10, TimeUnit.SECONDS); | ||
Object[] results = | ||
Arrays.stream(clusterValues) | ||
.map(v -> v.hasSingleData() ? v.getSingleValue() : v.getMultiValue()) |
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.
Should be always multivalue for cluster isn't 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.
depends on the route
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.
sorry, I missed this - transactions only support routing to single nodes, so there's no need to use ClusterValue.
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 will submit a follow-up PR to fix this then. Thanks for the comment.
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
8dc38f6
to
e25c55f
Compare
Issue #, if available:
Description of changes:
Adds transactions for both standalone and cluster clients using the
exec
command: by passing a route (for cluster clients) and a pipeline of commands in aTransaction
object. The object is then passed to Redis through thesubmitNewCommand(Transaction)
call.This PR is supposed for merge after #894
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.