Skip to content

Commit

Permalink
javadoc
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Jan 17, 2024
1 parent 9ead84c commit 8eaf785
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 5 additions & 1 deletion java/client/src/main/java/glide/api/BaseClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import lombok.AllArgsConstructor;
import lombok.Getter;

/** Base Client class for Redis */
/**
* Base Client class for Redis
*
* @param <T> The data return type.
*/
@AllArgsConstructor
public abstract class BaseClient<T> implements AutoCloseable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package glide.managers;

import glide.api.ClusterClient;
import glide.api.models.RedisValue;
import glide.api.models.configuration.Routes;
import glide.connectors.handlers.ChannelHandler;
import glide.models.RequestBuilder;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import redis_request.RedisRequestOuterClass;
import redis_request.RedisRequestOuterClass.RequestType;

/**
* {@link CommandManager} extension for {@link ClusterClient}.
*
* @param <T> The data return type - only {@link RedisValue} is supported.
*/
public class ClusterCommandManager<T> extends CommandManager<T> {
public ClusterCommandManager(ChannelHandler channel, Function<Object, T> dataConverter) {
super(channel, dataConverter);
Expand All @@ -21,7 +28,7 @@ public ClusterCommandManager(ChannelHandler channel, Function<Object, T> dataCon
* @param routes Request routing configuration
*/
public CompletableFuture<T> get(String key, Routes routes) {
return submitNewRequest(RedisRequestOuterClass.RequestType.GetString, List.of(key), routes);
return submitNewRequest(RequestType.GetString, List.of(key), routes);
}

/**
Expand All @@ -33,8 +40,7 @@ public CompletableFuture<T> get(String key, Routes routes) {
* @param routes Request routing configuration
*/
public CompletableFuture<T> set(String key, String value, Routes routes) {
return submitNewRequest(
RedisRequestOuterClass.RequestType.SetString, List.of(key, value), routes);
return submitNewRequest(RequestType.SetString, List.of(key, value), routes);
}

/**
Expand All @@ -46,7 +52,7 @@ public CompletableFuture<T> set(String key, String value, Routes routes) {
* @return A result promise
*/
private CompletableFuture<T> submitNewRequest(
RedisRequestOuterClass.RequestType command, List<String> args, Routes routes) {
RequestType command, List<String> args, Routes routes) {
return channel
.write(RequestBuilder.prepareRedisRequest(command, args, routes), true)
.thenApplyAsync(this::extractValueFromGlideRsResponse)
Expand Down
2 changes: 2 additions & 0 deletions java/client/src/main/java/glide/managers/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
/**
* Service responsible for submitting command requests to a socket channel handler and unpack
* responses from the same socket channel handler.
*
* @param <T> The data return type - only {@link String} is supported.
*/
@RequiredArgsConstructor
public class CommandManager<T> {
Expand Down

0 comments on commit 8eaf785

Please sign in to comment.