Package com.couchbase.client.core.msg.kv
Class BaseKeyValueRequest<R extends Response>
java.lang.Object
com.couchbase.client.core.msg.BaseRequest<R>
com.couchbase.client.core.msg.kv.BaseKeyValueRequest<R>
- All Implemented Interfaces:
KeyValueRequest<R>,Request<R>,ScopedRequest
- Direct Known Subclasses:
AppendRequest,CarrierBucketConfigRequest,CarrierGlobalConfigRequest,DecrementRequest,GetAndLockRequest,GetAndTouchRequest,GetCollectionIdRequest,GetCollectionManifestRequest,GetMetaRequest,GetRequest,IncrementRequest,InsertRequest,MultiObserveViaCasRequest,NoopRequest,ObserveViaCasRequest,ObserveViaSeqnoRequest,PrependRequest,RemoveRequest,ReplaceRequest,SubdocGetRequest,SubdocMutateRequest,TouchRequest,UnlockRequest,UpsertRequest
public abstract class BaseKeyValueRequest<R extends Response> extends BaseRequest<R> implements KeyValueRequest<R>
The
BaseKeyValueRequest should be subclassed by all KeyValue requests since it
provides common ground for all of them (i.e. adding the kv partition needed).- Since:
- 2.0.0
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseKeyValueRequest(Duration timeout, CoreContext ctx, RetryStrategy retryStrategy, String key, CollectionIdentifier collectionIdentifier)protectedBaseKeyValueRequest(Duration timeout, CoreContext ctx, RetryStrategy retryStrategy, String key, CollectionIdentifier collectionIdentifier, RequestSpan span) -
Method Summary
Modifier and Type Method Description Stringbucket()CollectionIdentifiercollectionIdentifier()protected com.couchbase.client.core.deps.io.netty.buffer.ByteBufencodedKeyWithCollection(com.couchbase.client.core.deps.io.netty.buffer.ByteBufAllocator alloc, KeyValueChannelContext ctx)This method with return an encoded key with or without the collection prefix, depending on the context provided.byte[]key()The key of the kv request.static intnextOpaque()intopaque()StringoperationId()Returns a potentially non-unique identifier that is useful for tracing output.shortpartition()Reads the currently set partition this request is targeted against.voidpartition(short partition)Allows to set the partition used for this request.Map<String,Object>serviceContext()Returns contextual information for each individual service.ServiceTypeserviceType()The service type of this request.Methods inherited from class com.couchbase.client.core.msg.BaseRequest
absoluteTimeout, cancel, cancellationReason, cancelled, completed, context, createdAt, fail, failed, id, requestSpan, response, retryStrategy, succeed, succeeded, timeout, timeoutElapsedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.couchbase.client.core.msg.kv.KeyValueRequest
decode, encodeMethods inherited from interface com.couchbase.client.core.msg.Request
absoluteTimeout, cancel, cancellationReason, cancelled, completed, context, createdAt, fail, failed, id, idempotent, name, requestSpan, response, retryStrategy, succeed, succeeded, timeout, timeoutElapsed
-
Constructor Details
-
BaseKeyValueRequest
protected BaseKeyValueRequest(Duration timeout, CoreContext ctx, RetryStrategy retryStrategy, String key, CollectionIdentifier collectionIdentifier) -
BaseKeyValueRequest
protected BaseKeyValueRequest(Duration timeout, CoreContext ctx, RetryStrategy retryStrategy, String key, CollectionIdentifier collectionIdentifier, RequestSpan span)
-
-
Method Details
-
nextOpaque
public static int nextOpaque() -
partition
public short partition()Description copied from interface:KeyValueRequestReads the currently set partition this request is targeted against.- Specified by:
partitionin interfaceKeyValueRequest<R extends Response>
-
partition
public void partition(short partition)Description copied from interface:KeyValueRequestAllows to set the partition used for this request.- Specified by:
partitionin interfaceKeyValueRequest<R extends Response>- Parameters:
partition- the partition to set.
-
encodedKeyWithCollection
protected com.couchbase.client.core.deps.io.netty.buffer.ByteBuf encodedKeyWithCollection(com.couchbase.client.core.deps.io.netty.buffer.ByteBufAllocator alloc, KeyValueChannelContext ctx)This method with return an encoded key with or without the collection prefix, depending on the context provided.- Parameters:
alloc- the buffer allocator to use.ctx- the channel context.- Returns:
- the encoded ID, maybe with the collection prefix in place.
-
serviceType
Description copied from interface:RequestThe service type of this request.- Specified by:
serviceTypein interfaceRequest<R extends Response>- Returns:
- the service type for this request.
-
opaque
public int opaque()- Specified by:
opaquein interfaceKeyValueRequest<R extends Response>
-
serviceContext
Description copied from interface:RequestReturns contextual information for each individual service.- Specified by:
serviceContextin interfaceRequest<R extends Response>- Overrides:
serviceContextin classBaseRequest<R extends Response>- Returns:
- the service context.
-
key
public byte[] key()Description copied from interface:KeyValueRequestThe key of the kv request.- Specified by:
keyin interfaceKeyValueRequest<R extends Response>- Returns:
- the key of the request.
-
bucket
- Specified by:
bucketin interfaceScopedRequest
-
collectionIdentifier
- Specified by:
collectionIdentifierin interfaceKeyValueRequest<R extends Response>
-
operationId
Description copied from interface:RequestReturns a potentially non-unique identifier that is useful for tracing output.Note: might be null! It depends on the type of operation. It is also different from the unqiue operation ID that increments to provide additional context (i.e in query the context uuid, in kv the opaque value).
- Specified by:
operationIdin interfaceRequest<R extends Response>- Returns:
- if present, the operation id. Null otherwise.
-