
com.lambdaworks.redis.cluster.api.reactive.RedisClusterReactiveCommands Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lettuce Show documentation
Show all versions of lettuce Show documentation
Advanced and thread-safe Java Redis client for synchronous, asynchronous, and
reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs
and much more.
The newest version!
/*
* Copyright 2011-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.lambdaworks.redis.cluster.api.reactive;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.lambdaworks.redis.KeyValue;
import com.lambdaworks.redis.api.reactive.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* A complete reactive and thread-safe cluster Redis API with 400+ Methods.
*
* @param Key type.
* @param Value type.
* @author Mark Paluch
* @since 5.0
*/
public interface RedisClusterReactiveCommands extends RedisHashReactiveCommands, RedisKeyReactiveCommands,
RedisStringReactiveCommands, RedisListReactiveCommands, RedisSetReactiveCommands,
RedisSortedSetReactiveCommands, RedisScriptingReactiveCommands, RedisServerReactiveCommands,
RedisHLLReactiveCommands, RedisGeoReactiveCommands, BaseRedisReactiveCommands {
/**
* Set the default timeout for operations.
*
* @param timeout the timeout value
* @param unit the unit of the timeout value
*/
void setTimeout(long timeout, TimeUnit unit);
/**
* Authenticate to the server.
*
* @param password the password
* @return String simple-string-reply
*/
Mono auth(String password);
/**
* Generate a new config epoch, incrementing the current epoch, assign the new epoch to this node, WITHOUT any consensus and
* persist the configuration on disk before sending packets with the new configuration.
*
* @return String simple-string-reply If the new config epoch is generated and assigned either BUMPED (epoch) or STILL
* (epoch) are returned.
*/
Mono clusterBumpepoch();
/**
* Meet another cluster node to include the node into the cluster. The command starts the cluster handshake and returns with
* {@literal OK} when the node was added to the cluster.
*
* @param ip IP address of the host
* @param port port number.
* @return String simple-string-reply
*/
Mono clusterMeet(String ip, int port);
/**
* Blacklist and remove the cluster node from the cluster.
*
* @param nodeId the node Id
* @return String simple-string-reply
*/
Mono clusterForget(String nodeId);
/**
* Adds slots to the cluster node. The current node will become the master for the specified slots.
*
* @param slots one or more slots from {@literal 0} to {@literal 16384}
* @return String simple-string-reply
*/
Mono clusterAddSlots(int... slots);
/**
* Removes slots from the cluster node.
*
* @param slots one or more slots from {@literal 0} to {@literal 16384}
* @return String simple-string-reply
*/
Mono clusterDelSlots(int... slots);
/**
* Assign a slot to a node. The command migrates the specified slot from the current node to the specified node in
* {@code nodeId}
*
* @param slot the slot
* @param nodeId the id of the node that will become the master for the slot
* @return String simple-string-reply
*/
Mono clusterSetSlotNode(int slot, String nodeId);
/**
* Clears migrating / importing state from the slot.
*
* @param slot the slot
* @return String simple-string-reply
*/
Mono clusterSetSlotStable(int slot);
/**
* Flag a slot as {@literal MIGRATING} (outgoing) towards the node specified in {@code nodeId}. The slot must be handled by
* the current node in order to be migrated.
*
* @param slot the slot
* @param nodeId the id of the node is targeted to become the master for the slot
* @return String simple-string-reply
*/
Mono clusterSetSlotMigrating(int slot, String nodeId);
/**
* Flag a slot as {@literal IMPORTING} (incoming) from the node specified in {@code nodeId}.
*
* @param slot the slot
* @param nodeId the id of the node is the master of the slot
* @return String simple-string-reply
*/
Mono clusterSetSlotImporting(int slot, String nodeId);
/**
* Get information and statistics about the cluster viewed by the current node.
*
* @return String bulk-string-reply as a collection of text lines.
*/
Mono clusterInfo();
/**
* Obtain the nodeId for the currently connected node.
*
* @return String simple-string-reply
*/
Mono clusterMyId();
/**
* Obtain details about all cluster nodes. Can be parsed using
* {@link com.lambdaworks.redis.cluster.models.partitions.ClusterPartitionParser#parse}
*
* @return String bulk-string-reply as a collection of text lines
*/
Mono clusterNodes();
/**
* List slaves for a certain node identified by its {@code nodeId}. Can be parsed using
* {@link com.lambdaworks.redis.cluster.models.partitions.ClusterPartitionParser#parse}
*
* @param nodeId node id of the master node
* @return List<String> array-reply list of slaves. The command returns data in the same format as
* {@link #clusterNodes()} but one line per slave.
*/
Flux clusterSlaves(String nodeId);
/**
* Retrieve the list of keys within the {@code slot}.
*
* @param slot the slot
* @param count maximal number of keys
* @return List<K> array-reply list of keys
*/
Flux clusterGetKeysInSlot(int slot, int count);
/**
* Returns the number of keys in the specified Redis Cluster hash {@code slot}.
*
* @param slot the slot
* @return Integer reply: The number of keys in the specified hash slot, or an error if the hash slot is invalid.
*/
Mono clusterCountKeysInSlot(int slot);
/**
* Returns the number of failure reports for the specified node. Failure reports are the way Redis Cluster uses in order to
* promote a {@literal PFAIL} state, that means a node is not reachable, to a {@literal FAIL} state, that means that the
* majority of masters in the cluster agreed within a window of time that the node is not reachable.
*
* @param nodeId the node id
* @return Integer reply: The number of active failure reports for the node.
*/
Mono clusterCountFailureReports(String nodeId);
/**
* Returns an integer identifying the hash slot the specified key hashes to. This command is mainly useful for debugging and
* testing, since it exposes via an API the underlying Redis implementation of the hashing algorithm. Basically the same as
* {@link com.lambdaworks.redis.cluster.SlotHash#getSlot(byte[])}. If not, call Houston and report that we've got a problem.
*
* @param key the key.
* @return Integer reply: The hash slot number.
*/
Mono clusterKeyslot(K key);
/**
* Forces a node to save the nodes.conf configuration on disk.
*
* @return String simple-string-reply: {@code OK} or an error if the operation fails.
*/
Mono clusterSaveconfig();
/**
* This command sets a specific config epoch in a fresh node. It only works when:
*
* - The nodes table of the node is empty.
* - The node current config epoch is zero.
*
*
* @param configEpoch the config epoch
* @return String simple-string-reply: {@code OK} or an error if the operation fails.
*/
Mono clusterSetConfigEpoch(long configEpoch);
/**
* Get array of cluster slots to node mappings.
*
* @return List<Object> array-reply nested list of slot ranges with IP/Port mappings.
*/
Flux
© 2015 - 2025 Weber Informatics LLC | Privacy Policy