Class ReplicaHelper

java.lang.Object
com.couchbase.client.core.service.kv.ReplicaHelper

@Internal public class ReplicaHelper extends Object
  • Method Details

    • getAllReplicasReactive

      public static Flux<ReplicaHelper.GetReplicaResponse> getAllReplicasReactive(Core core, CollectionIdentifier collectionIdentifier, String documentId, Duration timeout, RetryStrategy retryStrategy, Map<String,Object> clientContext, RequestSpan parentSpan)
      Parameters:
      clientContext - (nullable)
      parentSpan - (nullable)
    • lookupInAllReplicasReactive

      public static Flux<CoreSubdocGetResult> lookupInAllReplicasReactive(Core core, CollectionIdentifier collectionIdentifier, String documentId, List<CoreSubdocGetCommand> commands, Duration timeout, RetryStrategy retryStrategy, Map<String,Object> clientContext, RequestSpan parentSpan)
      Parameters:
      core - the core to execute the request
      collectionIdentifier - the collection containing the document
      documentId - the ID of the document
      commands - specifies the type of lookups to perform
      timeout - the timeout until we need to stop the get all replicas
      retryStrategy - the retry strategy to use
      clientContext - (nullable) client context info
      parentSpan - the "lookupIn all/any replicas" request span
      Returns:
      a flux of requests.
    • getAllReplicasAsync

      public static <R> CompletableFuture<List<CompletableFuture<R>>> getAllReplicasAsync(Core core, CollectionIdentifier collectionIdentifier, String documentId, Duration timeout, RetryStrategy retryStrategy, Map<String,Object> clientContext, RequestSpan parentSpan, Function<ReplicaHelper.GetReplicaResponse,R> responseMapper)
      Reads from replicas or the active node based on the options and returns the results as a list of futures that might complete or fail.
      Parameters:
      clientContext - (nullable)
      parentSpan - (nullable)
      responseMapper - converts the GetReplicaResponse to the client's native result type
      Returns:
      a list of results from the active and the replica.
    • lookupInAllReplicasAsync

      public static <R> CompletableFuture<List<CompletableFuture<R>>> lookupInAllReplicasAsync(Core core, CollectionIdentifier collectionIdentifier, String documentId, List<CoreSubdocGetCommand> commands, Duration timeout, RetryStrategy retryStrategy, Map<String,Object> clientContext, RequestSpan parentSpan, Function<CoreSubdocGetResult,R> responseMapper)
      Reads from replicas or the active node based on the options and returns the results as a list of futures that might complete or fail.
      Parameters:
      core - the core to execute the request
      collectionIdentifier - the collection containing the document
      documentId - the ID of the document
      commands - specifies the type of lookups to perform
      timeout - the timeout until we need to stop the get all replicas
      retryStrategy - the retry strategy to use
      clientContext - (nullable) client context info
      parentSpan - the "lookupIn all/any replicas" request span
      responseMapper - converts the GetReplicaResponse to the client's native result type
      Returns:
      a list of results from the active and the replica.
    • getAnyReplicaAsync

      public static <R> CompletableFuture<R> getAnyReplicaAsync(Core core, CollectionIdentifier collectionIdentifier, String documentId, Duration timeout, RetryStrategy retryStrategy, Map<String,Object> clientContext, RequestSpan parentSpan, Function<ReplicaHelper.GetReplicaResponse,R> responseMapper)
      Parameters:
      clientContext - (nullable)
      parentSpan - (nullable)
      responseMapper - converts the GetReplicaResponse to the client's native result type
    • lookupInAnyReplicaAsync

      public static <R> CompletableFuture<R> lookupInAnyReplicaAsync(Core core, CollectionIdentifier collectionIdentifier, String documentId, List<CoreSubdocGetCommand> commands, Duration timeout, RetryStrategy retryStrategy, Map<String,Object> clientContext, RequestSpan parentSpan, Function<CoreSubdocGetResult,R> responseMapper)
      Parameters:
      core - the core to execute the request
      collectionIdentifier - the collection containing the document
      documentId - the ID of the document
      commands - specifies the type of lookups to perform
      timeout - the timeout until we need to stop the get all replicas
      retryStrategy - the retry strategy to use
      clientContext - (nullable) client context info
      parentSpan - the "lookupIn all/any replicas" request span
      responseMapper - converts the CoreSubdocGetResult to the client's native result type
      Returns:
      a list of results from the active and the replica.
    • getAllReplicasRequests

      public static CompletableFuture<Stream<GetRequest>> getAllReplicasRequests(Core core, CollectionIdentifier collectionIdentifier, String documentId, Map<String,Object> clientContext, RetryStrategy retryStrategy, Duration timeout, RequestSpan parent)
      Helper method to assemble a stream of requests to the active and all replicas
      Parameters:
      core - the core to execute the request
      collectionIdentifier - the collection containing the document
      documentId - the ID of the document
      clientContext - (nullable) client context info
      retryStrategy - the retry strategy to use
      timeout - the timeout until we need to stop the get all replicas
      parent - the "get all/any replicas" request span
      Returns:
      a stream of requests.
    • lookupInAllReplicasRequests

      public static CompletableFuture<Stream<SubdocGetRequest>> lookupInAllReplicasRequests(Core core, CollectionIdentifier collectionIdentifier, String documentId, List<CoreSubdocGetCommand> commands, Map<String,Object> clientContext, RetryStrategy retryStrategy, Duration timeout, RequestSpan parent)
      Helper method to assemble a stream of requests to the active and all replicas
      Parameters:
      core - the core to execute the request
      collectionIdentifier - the collection containing the document
      documentId - the ID of the document
      commands - specifies the type of lookups to perform
      clientContext - (nullable) client context info
      retryStrategy - the retry strategy to use
      timeout - the timeout until we need to stop the get all replicas
      parent - the "get all/any replicas" request span
      Returns:
      a stream of requests.