Class ReplicaHelper
java.lang.Object
com.couchbase.client.core.service.kv.ReplicaHelper
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <R> CompletableFuture
<List<CompletableFuture<R>>> getAllReplicasAsync
(Core core, CollectionIdentifier collectionIdentifier, String documentId, Duration timeout, RetryStrategy retryStrategy, Map<String, Object> clientContext, RequestSpan parentSpan, CoreReadPreference readPreference, 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.static Flux
<ReplicaHelper.GetReplicaResponse> getAllReplicasReactive
(Core core, CollectionIdentifier collectionIdentifier, String documentId, Duration timeout, RetryStrategy retryStrategy, Map<String, Object> clientContext, RequestSpan parentSpan, CoreReadPreference readPreference) static CompletableFuture
<Stream<GetRequest>> getAllReplicasRequests
(Core core, CollectionIdentifier collectionIdentifier, String documentId, Map<String, Object> clientContext, RetryStrategy retryStrategy, Duration timeout, RequestSpan parent, CoreReadPreference readPreference) Helper method to assemble a stream of requests to the active and all replicasstatic <R> CompletableFuture
<R> getAnyReplicaAsync
(Core core, CollectionIdentifier collectionIdentifier, String documentId, Duration timeout, RetryStrategy retryStrategy, Map<String, Object> clientContext, RequestSpan parentSpan, CoreReadPreference readPreference, Function<ReplicaHelper.GetReplicaResponse, R> responseMapper) 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, CoreReadPreference readPreference, 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.static Flux
<CoreSubdocGetResult> lookupInAllReplicasReactive
(Core core, CollectionIdentifier collectionIdentifier, String documentId, List<CoreSubdocGetCommand> commands, Duration timeout, RetryStrategy retryStrategy, Map<String, Object> clientContext, RequestSpan parentSpan, CoreReadPreference readPreference) static CompletableFuture
<Stream<SubdocGetRequest>> lookupInAllReplicasRequests
(Core core, CollectionIdentifier collectionIdentifier, String documentId, List<CoreSubdocGetCommand> commands, Map<String, Object> clientContext, RetryStrategy retryStrategy, Duration timeout, RequestSpan parent, CoreReadPreference readPreference) Helper method to assemble a stream of requests to the active and all replicasstatic <R> CompletableFuture
<R> lookupInAnyReplicaAsync
(Core core, CollectionIdentifier collectionIdentifier, String documentId, List<CoreSubdocGetCommand> commands, Duration timeout, RetryStrategy retryStrategy, Map<String, Object> clientContext, RequestSpan parentSpan, CoreReadPreference readPreference, Function<CoreSubdocGetResult, R> responseMapper)
-
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, CoreReadPreference readPreference) - 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, CoreReadPreference readPreference) - Parameters:
core
- the core to execute the requestcollectionIdentifier
- the collection containing the documentdocumentId
- the ID of the documentcommands
- specifies the type of lookups to performtimeout
- the timeout until we need to stop the get all replicasretryStrategy
- the retry strategy to useclientContext
- (nullable) client context infoparentSpan
- 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, CoreReadPreference readPreference, 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, CoreReadPreference readPreference, 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 requestcollectionIdentifier
- the collection containing the documentdocumentId
- the ID of the documentcommands
- specifies the type of lookups to performtimeout
- the timeout until we need to stop the get all replicasretryStrategy
- the retry strategy to useclientContext
- (nullable) client context infoparentSpan
- the "lookupIn all/any replicas" request spanresponseMapper
- 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, CoreReadPreference readPreference, 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, CoreReadPreference readPreference, Function<CoreSubdocGetResult, R> responseMapper) - Parameters:
core
- the core to execute the requestcollectionIdentifier
- the collection containing the documentdocumentId
- the ID of the documentcommands
- specifies the type of lookups to performtimeout
- the timeout until we need to stop the get all replicasretryStrategy
- the retry strategy to useclientContext
- (nullable) client context infoparentSpan
- the "lookupIn all/any replicas" request spanresponseMapper
- 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, CoreReadPreference readPreference) Helper method to assemble a stream of requests to the active and all replicas- Parameters:
core
- the core to execute the requestcollectionIdentifier
- the collection containing the documentdocumentId
- the ID of the documentclientContext
- (nullable) client context inforetryStrategy
- the retry strategy to usetimeout
- the timeout until we need to stop the get all replicasparent
- 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, CoreReadPreference readPreference) Helper method to assemble a stream of requests to the active and all replicas- Parameters:
core
- the core to execute the requestcollectionIdentifier
- the collection containing the documentdocumentId
- the ID of the documentcommands
- specifies the type of lookups to performclientContext
- (nullable) client context inforetryStrategy
- the retry strategy to usetimeout
- the timeout until we need to stop the get all replicasparent
- the "get all/any replicas" request span- Returns:
- a stream of requests.
-
CoreGetResult
in new code.