Skip to content
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

[Can be deleted] Java: API layer with single commands (base, string, & void) #49

Closed
wants to merge 20 commits into from

Conversation

acarbonetto
Copy link

Depends on valkey-io#717.

Issue #, if available:

API layer for: valkey-io#589

Description of changes:

In this PR, we're adding an API layer that creates a RedisClient using a RedisConfiguration.
Introduces the get & set & customCommand calls that allow a user to use the RedisClient.
This PR ensures that the type returned from the get/set/customCommand is correct for the type. A request using Exec returns a generic instead.

Out of Scope

Use cases

// connect to Redis
CompletableFuture<babushka.client.api.RedisClient> redisClientConnection =
    babushka.client.api.RedisClient.CreateClient(configuration);

// resolve the Future and get a RedisClient
babushka.client.api.RedisClient redisClient = redisClientConnection.get();

SetOptions setOptions = SetOptions.builder()
    .returnOldValue(true) // returns a String
    .build();
CompletableFuture<String> setRequest = redisClient.set("apples", "oranges", setOptions);
String oldValue = setRequest.get(); // returns a string unless .returnOldValue() is not true

CompletableFuture<String> getRequest = redisClient.get("apples");
String getValueStr = getRequest.get();
getValueStr == "oranges";  

design-java-api-detailed-level

design-java-api-sequence-datatypes

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@acarbonetto acarbonetto force-pushed the java/integ_acarbo_refactor_api_createclient branch from 09fd5c7 to 617ab3e Compare January 3, 2024 22:35
@acarbonetto acarbonetto force-pushed the java/integ_acarbo_refactor_api_submitRequests branch from 6d82f84 to 9db449c Compare January 3, 2024 23:34
java/client/src/test/java/glide/api/Awaiter.java Outdated Show resolved Hide resolved
import response.ResponseOuterClass;
import response.ResponseOuterClass.Response;

public class ConnectionManagerTest {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate of ConnectionManagerTest in managers.ConnectionManagerTest

@acarbonetto acarbonetto force-pushed the java/integ_acarbo_refactor_api_submitRequests branch from e4dda03 to dd40a72 Compare January 5, 2024 13:19
if (value instanceof String) {
return (String) value;
}
throw new RedisException(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider return type: maybe ClosingException? and we close the client?

@acarbonetto acarbonetto force-pushed the java/integ_acarbo_refactor_api_submitRequests branch from 4b83ad4 to cb1966e Compare January 10, 2024 21:23
@acarbonetto acarbonetto changed the base branch from java/integ_acarbo_refactor_api_createclient to main January 11, 2024 21:01
acarbonetto and others added 20 commits January 11, 2024 13:08
* Add java client connection layer.

Signed-off-by: Andrew Carbonetto <[email protected]>

---------

Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Co-authored-by: Yury-Fridlyand <[email protected]>
Co-authored-by: SanHalacogluImproving <[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]>
* Add java client connection layer.

Signed-off-by: Andrew Carbonetto <[email protected]>

---------

Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Co-authored-by: Yury-Fridlyand <[email protected]>
Co-authored-by: SanHalacogluImproving <[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]>
@acarbonetto acarbonetto force-pushed the java/integ_acarbo_refactor_api_submitRequests branch from cb1966e to cada9b7 Compare January 11, 2024 21:38
@acarbonetto acarbonetto changed the title Java: API layer with single commands (base, string, & void) [Can be deleted] Java: API layer with single commands (base, string, & void) Jan 15, 2024
@acarbonetto acarbonetto deleted the java/integ_acarbo_refactor_api_submitRequests branch January 25, 2024 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants