Skip to content

Commit

Permalink
Java: Fix routing for FLUSHALL and FLUSHDB. (valkey-io#1608)
Browse files Browse the repository at this point in the history
Fix routing for `FLUSHALL` and `FLUSHDB`. (#379)

Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand authored Jun 20, 2024
1 parent 50e5ff3 commit 48ed143
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
10 changes: 4 additions & 6 deletions java/client/src/main/java/glide/api/RedisClusterClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,13 @@ public CompletableFuture<String> flushall(@NonNull FlushMode mode) {
}

@Override
public CompletableFuture<String> flushall(@NonNull SingleNodeRoute route) {
public CompletableFuture<String> flushall(@NonNull Route route) {
return commandManager.submitNewCommand(
FlushAll, new String[0], route, this::handleStringResponse);
}

@Override
public CompletableFuture<String> flushall(
@NonNull FlushMode mode, @NonNull SingleNodeRoute route) {
public CompletableFuture<String> flushall(@NonNull FlushMode mode, @NonNull Route route) {
return commandManager.submitNewCommand(
FlushAll, new String[] {mode.toString()}, route, this::handleStringResponse);
}
Expand All @@ -360,14 +359,13 @@ public CompletableFuture<String> flushdb(@NonNull FlushMode mode) {
}

@Override
public CompletableFuture<String> flushdb(@NonNull SingleNodeRoute route) {
public CompletableFuture<String> flushdb(@NonNull Route route) {
return commandManager.submitNewCommand(
FlushDB, new String[0], route, this::handleStringResponse);
}

@Override
public CompletableFuture<String> flushdb(
@NonNull FlushMode mode, @NonNull SingleNodeRoute route) {
public CompletableFuture<String> flushdb(@NonNull FlushMode mode, @NonNull Route route) {
return commandManager.submitNewCommand(
FlushDB, new String[] {mode.toString()}, route, this::handleStringResponse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import glide.api.models.commands.InfoOptions;
import glide.api.models.commands.InfoOptions.Section;
import glide.api.models.configuration.RequestRoutingConfiguration.Route;
import glide.api.models.configuration.RequestRoutingConfiguration.SingleNodeRoute;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

Expand Down Expand Up @@ -353,7 +352,7 @@ public interface ServerManagementClusterCommands {
*
* @see <a href="https://valkey.io/commands/flushall/">valkey.io</a> for details.
* @param route Specifies the routing configuration for the command. The client will route the
* command to the node defined by <code>route</code>.
* command to the nodes defined by <code>route</code>.
* @return <code>OK</code>.
* @example
* <pre>{@code
Expand All @@ -362,7 +361,7 @@ public interface ServerManagementClusterCommands {
* assert response.equals("OK");
* }</pre>
*/
CompletableFuture<String> flushall(SingleNodeRoute route);
CompletableFuture<String> flushall(Route route);

/**
* Deletes all the keys of all the existing databases. This command never fails.
Expand All @@ -371,7 +370,7 @@ public interface ServerManagementClusterCommands {
* @param mode The flushing mode, could be either {@link FlushMode#SYNC} or {@link
* FlushMode#ASYNC}.
* @param route Specifies the routing configuration for the command. The client will route the
* command to the node defined by <code>route</code>.
* command to the nodes defined by <code>route</code>.
* @return <code>OK</code>.
* @example
* <pre>{@code
Expand All @@ -380,7 +379,7 @@ public interface ServerManagementClusterCommands {
* assert response.equals("OK");
* }</pre>
*/
CompletableFuture<String> flushall(FlushMode mode, SingleNodeRoute route);
CompletableFuture<String> flushall(FlushMode mode, Route route);

/**
* Deletes all the keys of the currently selected database. This command never fails.<br>
Expand Down Expand Up @@ -417,7 +416,7 @@ public interface ServerManagementClusterCommands {
*
* @see <a href="https://valkey.io/commands/flushdb/">valkey.io</a> for details.
* @param route Specifies the routing configuration for the command. The client will route the
* command to the node defined by <code>route</code>.
* command to the nodes defined by <code>route</code>.
* @return <code>OK</code>.
* @example
* <pre>{@code
Expand All @@ -426,7 +425,7 @@ public interface ServerManagementClusterCommands {
* assert response.equals("OK");
* }</pre>
*/
CompletableFuture<String> flushdb(SingleNodeRoute route);
CompletableFuture<String> flushdb(Route route);

/**
* Deletes all the keys of the currently selected database. This command never fails.
Expand All @@ -435,7 +434,7 @@ public interface ServerManagementClusterCommands {
* @param mode The flushing mode, could be either {@link FlushMode#SYNC} or {@link
* FlushMode#ASYNC}.
* @param route Specifies the routing configuration for the command. The client will route the
* command to the node defined by <code>route</code>.
* command to the nodes defined by <code>route</code>.
* @return <code>OK</code>.
* @example
* <pre>{@code
Expand All @@ -444,7 +443,7 @@ public interface ServerManagementClusterCommands {
* assert response.equals("OK");
* }</pre>
*/
CompletableFuture<String> flushdb(FlushMode mode, SingleNodeRoute route);
CompletableFuture<String> flushdb(FlushMode mode, Route route);

/**
* Displays a piece of generative computer art and the Redis version.<br>
Expand Down

0 comments on commit 48ed143

Please sign in to comment.