Class RedisCluster

java.lang.Object
io.vertx.mutiny.redis.client.RedisCluster
All Implemented Interfaces:
MutinyDelegate

public class RedisCluster extends Object implements MutinyDelegate
Utilities for Redis cluster. Calling create() with an instance of Redis or RedisConnection that are not Redis cluster client/connection leads to an exception.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final TypeArg<RedisCluster>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RedisCluster(io.vertx.redis.client.RedisCluster delegate)
    Create a new instance of RedisCluster delegating to the given (non-null) instance of RedisCluster.
    RedisCluster(Object delegate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    create(Redis client)
     
    create(RedisConnection connection)
     
    boolean
     
    io.vertx.redis.client.RedisCluster
    Get the delegate instance.
    io.smallrye.mutiny.Uni<io.vertx.redis.client.RequestGrouping>
    groupByNodes(List<io.vertx.redis.client.Request> requests)
    Groups the requests into a RequestGrouping, which contains: keyed requests: requests that include a key and it is therefore possible to determine to which master node they should be sent; all requests in each inner list in the keyed collection are guaranteed to be sent to the same master node; unkeyed requests: requests that do not include a key and it is therefore not possible to determine to which master node they should be sent. If any of the requests includes multiple keys that belong to different master nodes, the resulting uni will fail.
    io.vertx.redis.client.RequestGrouping
    groupByNodesAndAwait(List<io.vertx.redis.client.Request> requests)
    Groups the requests into a RequestGrouping, which contains: keyed requests: requests that include a key and it is therefore possible to determine to which master node they should be sent; all requests in each inner list in the keyed collection are guaranteed to be sent to the same master node; unkeyed requests: requests that do not include a key and it is therefore not possible to determine to which master node they should be sent. If any of the requests includes multiple keys that belong to different master nodes, the resulting underlying uni will fail.
    groupByNodesAndForget(List<io.vertx.redis.client.Request> requests)
    Groups the requests into a RequestGrouping, which contains: keyed requests: requests that include a key and it is therefore possible to determine to which master node they should be sent; all requests in each inner list in the keyed collection are guaranteed to be sent to the same master node; unkeyed requests: requests that do not include a key and it is therefore not possible to determine to which master node they should be sent. If any of the requests includes multiple keys that belong to different master nodes, the resulting underlying uni will fail.
    int
     
    newInstance(io.vertx.redis.client.RedisCluster delegate)
    Creates a new instance of the RedisCluster.
    io.smallrye.mutiny.Uni<List<io.vertx.redis.client.Response>>
    onAllMasterNodes(io.vertx.redis.client.Request request)
    Runs the request against all master nodes in the cluster.
    List<io.vertx.redis.client.Response>
    onAllMasterNodesAndAwait(io.vertx.redis.client.Request request)
    Runs the request against all master nodes in the cluster.
    onAllMasterNodesAndForget(io.vertx.redis.client.Request request)
    Runs the request against all master nodes in the cluster.
    io.smallrye.mutiny.Uni<List<io.vertx.redis.client.Response>>
    onAllNodes(io.vertx.redis.client.Request request)
    Runs the request against all nodes in the cluster.
    List<io.vertx.redis.client.Response>
    onAllNodesAndAwait(io.vertx.redis.client.Request request)
    Runs the request against all nodes in the cluster.
    onAllNodesAndForget(io.vertx.redis.client.Request request)
    Runs the request against all nodes in the cluster.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • RedisCluster

      public RedisCluster(io.vertx.redis.client.RedisCluster delegate)
      Create a new instance of RedisCluster delegating to the given (non-null) instance of RedisCluster.
    • RedisCluster

      public RedisCluster(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.redis.client.RedisCluster getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • onAllNodes

      @CheckReturnValue public io.smallrye.mutiny.Uni<List<io.vertx.redis.client.Response>> onAllNodes(io.vertx.redis.client.Request request)
      Runs the request against all nodes in the cluster. Returns a uni that completes with a list of responses, one from each node, or failure when one of the operations fails. Note that in case of a failure, there are no guarantees that the request was or wasn't executed successfully on other Redis cluster nodes. No result order is guaranteed either.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      request - the request, must not be null
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • RedisCluster.onAllNodes(Request)
    • onAllNodesAndAwait

      public List<io.vertx.redis.client.Response> onAllNodesAndAwait(io.vertx.redis.client.Request request)
      Runs the request against all nodes in the cluster. Returns a underlying uni that completes with a list of responses, one from each node, or failure when one of the operations fails. Note that in case of a failure, there are no guarantees that the request was or wasn't executed successfully on other Redis cluster nodes. No result order is guaranteed either.

      Unlike the bare Vert.x variant, this method returns a List<io.vertx.redis.client.Response>. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      request - the request, must not be null
      Returns:
      The operation result
      See Also:
      • RedisCluster.onAllNodes(Request)
    • onAllNodesAndForget

      public RedisCluster onAllNodesAndForget(io.vertx.redis.client.Request request)
      Runs the request against all nodes in the cluster. Returns a underlying uni that completes with a list of responses, one from each node, or failure when one of the operations fails. Note that in case of a failure, there are no guarantees that the request was or wasn't executed successfully on other Redis cluster nodes. No result order is guaranteed either.

      Unlike the bare Vert.x variant, this method ignores the List<io.vertx.redis.client.Response> result or any failure.

      Parameters:
      request - the request, must not be null
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • RedisCluster.onAllNodes(Request)
    • onAllMasterNodes

      @CheckReturnValue public io.smallrye.mutiny.Uni<List<io.vertx.redis.client.Response>> onAllMasterNodes(io.vertx.redis.client.Request request)
      Runs the request against all master nodes in the cluster. Returns a uni that completes with a list of responses, one from each master node, or failure when one of the operations fails. Note that in case of a failure, there are no guarantees that the request was or wasn't executed successfully on other Redis cluster master nodes. No result order is guaranteed either.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      request - the request, must not be null
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • RedisCluster.onAllMasterNodes(Request)
    • onAllMasterNodesAndAwait

      public List<io.vertx.redis.client.Response> onAllMasterNodesAndAwait(io.vertx.redis.client.Request request)
      Runs the request against all master nodes in the cluster. Returns a underlying uni that completes with a list of responses, one from each master node, or failure when one of the operations fails. Note that in case of a failure, there are no guarantees that the request was or wasn't executed successfully on other Redis cluster master nodes. No result order is guaranteed either.

      Unlike the bare Vert.x variant, this method returns a List<io.vertx.redis.client.Response>. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      request - the request, must not be null
      Returns:
      The operation result
      See Also:
      • RedisCluster.onAllMasterNodes(Request)
    • onAllMasterNodesAndForget

      public RedisCluster onAllMasterNodesAndForget(io.vertx.redis.client.Request request)
      Runs the request against all master nodes in the cluster. Returns a underlying uni that completes with a list of responses, one from each master node, or failure when one of the operations fails. Note that in case of a failure, there are no guarantees that the request was or wasn't executed successfully on other Redis cluster master nodes. No result order is guaranteed either.

      Unlike the bare Vert.x variant, this method ignores the List<io.vertx.redis.client.Response> result or any failure.

      Parameters:
      request - the request, must not be null
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • RedisCluster.onAllMasterNodes(Request)
    • groupByNodes

      @CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.redis.client.RequestGrouping> groupByNodes(List<io.vertx.redis.client.Request> requests)
      Groups the requests into a RequestGrouping, which contains:
      • keyed requests: requests that include a key and it is therefore possible to determine to which master node they should be sent; all requests in each inner list in the keyed collection are guaranteed to be sent to the same master node;
      • unkeyed requests: requests that do not include a key and it is therefore not possible to determine to which master node they should be sent.
      If any of the requests includes multiple keys that belong to different master nodes, the resulting uni will fail.

      If the cluster client was created with RedisReplicas#SHARE or RedisReplicas#ALWAYS and the commands are executed individually (using send(), not batch()), it is possible that the commands will be spread across different replicas of the same master node.

      Note that this method is only reliable in case the Redis cluster is in a stable state. In case of resharding, failover or in general any change of cluster topology, there are no guarantees on the validity of the result.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      requests - the requests, must not be null
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • RedisCluster.groupByNodes(List)
    • groupByNodesAndAwait

      public io.vertx.redis.client.RequestGrouping groupByNodesAndAwait(List<io.vertx.redis.client.Request> requests)
      Groups the requests into a RequestGrouping, which contains:
      • keyed requests: requests that include a key and it is therefore possible to determine to which master node they should be sent; all requests in each inner list in the keyed collection are guaranteed to be sent to the same master node;
      • unkeyed requests: requests that do not include a key and it is therefore not possible to determine to which master node they should be sent.
      If any of the requests includes multiple keys that belong to different master nodes, the resulting underlying uni will fail.

      If the cluster client was created with RedisReplicas#SHARE or RedisReplicas#ALWAYS and the commands are executed individually (using send(), not batch()), it is possible that the commands will be spread across different replicas of the same master node.

      Note that this method is only reliable in case the Redis cluster is in a stable state. In case of resharding, failover or in general any change of cluster topology, there are no guarantees on the validity of the result.

      Unlike the bare Vert.x variant, this method returns a RequestGrouping. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      requests - the requests, must not be null
      Returns:
      The operation result
      See Also:
      • RedisCluster.groupByNodes(List)
    • groupByNodesAndForget

      public RedisCluster groupByNodesAndForget(List<io.vertx.redis.client.Request> requests)
      Groups the requests into a RequestGrouping, which contains:
      • keyed requests: requests that include a key and it is therefore possible to determine to which master node they should be sent; all requests in each inner list in the keyed collection are guaranteed to be sent to the same master node;
      • unkeyed requests: requests that do not include a key and it is therefore not possible to determine to which master node they should be sent.
      If any of the requests includes multiple keys that belong to different master nodes, the resulting underlying uni will fail.

      If the cluster client was created with RedisReplicas#SHARE or RedisReplicas#ALWAYS and the commands are executed individually (using send(), not batch()), it is possible that the commands will be spread across different replicas of the same master node.

      Note that this method is only reliable in case the Redis cluster is in a stable state. In case of resharding, failover or in general any change of cluster topology, there are no guarantees on the validity of the result.

      Unlike the bare Vert.x variant, this method ignores the RequestGrouping result or any failure.

      Parameters:
      requests - the requests, must not be null
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • RedisCluster.groupByNodes(List)
    • create

      public static RedisCluster create(Redis client)
    • create

      public static RedisCluster create(RedisConnection connection)
    • newInstance

      public static RedisCluster newInstance(io.vertx.redis.client.RedisCluster delegate)
      Creates a new instance of the RedisCluster.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object