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

Java: Fix routing for FLUSHALL and FLUSHDB. #379

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>.

Choose a reason for hiding this comment

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

❤️

* @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
Loading