Search in sources :

Example 1 with GetMetaRequest

use of com.couchbase.client.core.msg.kv.GetMetaRequest in project couchbase-jvm-clients by couchbase.

the class AsyncCollection method existsRequest.

/**
 * Helper method to create the exists request from its options.
 *
 * @param id the document ID
 * @param options custom options to change the default behavior
 * @return the observe request used for exists.
 */
GetMetaRequest existsRequest(final String id, final ExistsOptions options) {
    notNullOrEmpty(id, "Id", () -> ReducedKeyValueErrorContext.create(id, collectionIdentifier));
    notNull(options, "ExistsOptions", () -> ReducedKeyValueErrorContext.create(id, collectionIdentifier));
    ExistsOptions.Built opts = options.build();
    Duration timeout = opts.timeout().orElse(environment.timeoutConfig().kvTimeout());
    RetryStrategy retryStrategy = opts.retryStrategy().orElse(environment.retryStrategy());
    RequestSpan span = environment.requestTracer().requestSpan(TracingIdentifiers.SPAN_REQUEST_KV_EXISTS, opts.parentSpan().orElse(null));
    GetMetaRequest request = new GetMetaRequest(id, timeout, coreContext, collectionIdentifier, retryStrategy, span);
    request.context().clientContext(opts.clientContext());
    return request;
}
Also used : GetMetaRequest(com.couchbase.client.core.msg.kv.GetMetaRequest) Duration(java.time.Duration) ExistsOptions(com.couchbase.client.java.kv.ExistsOptions) RetryStrategy(com.couchbase.client.core.retry.RetryStrategy) RequestSpan(com.couchbase.client.core.cnc.RequestSpan)

Aggregations

RequestSpan (com.couchbase.client.core.cnc.RequestSpan)1 GetMetaRequest (com.couchbase.client.core.msg.kv.GetMetaRequest)1 RetryStrategy (com.couchbase.client.core.retry.RetryStrategy)1 ExistsOptions (com.couchbase.client.java.kv.ExistsOptions)1 Duration (java.time.Duration)1