public abstract class BaseKeyValueRequest<R extends Response> extends BaseRequest<R> implements KeyValueRequest<R>
BaseKeyValueRequest should be subclassed by all KeyValue requests since it
provides common ground for all of them (i.e. adding the kv partition needed).| Modifier | Constructor and Description |
|---|---|
protected |
BaseKeyValueRequest(Duration timeout,
CoreContext ctx,
RetryStrategy retryStrategy,
String key,
CollectionIdentifier collectionIdentifier) |
protected |
BaseKeyValueRequest(Duration timeout,
CoreContext ctx,
RetryStrategy retryStrategy,
String key,
CollectionIdentifier collectionIdentifier,
RequestSpan span) |
| Modifier and Type | Method and Description |
|---|---|
String |
bucket() |
CollectionIdentifier |
collectionIdentifier() |
protected com.couchbase.client.core.deps.io.netty.buffer.ByteBuf |
encodedExternalKeyWithCollection(com.couchbase.client.core.deps.io.netty.buffer.ByteBufAllocator alloc,
KeyValueChannelContext ctx,
byte[] key)
Encodes a given key with the collection prefix if needed.
|
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 returns an encoded key with or without the collection prefix, depending on the
context provided.
|
byte[] |
key()
The key of the kv request.
|
static int |
nextOpaque() |
int |
opaque() |
String |
operationId()
Returns a potentially non-unique identifier that is useful for tracing output.
|
short |
partition()
Reads the currently set partition this request is targeted against.
|
void |
partition(short partition)
Allows to set the partition used for this request.
|
Map<String,Object> |
serviceContext()
Returns contextual information for each individual service.
|
ServiceType |
serviceType()
The service type of this request.
|
absoluteTimeout, cancel, cancellationReason, cancelled, completed, context, createdAt, fail, failed, id, requestSpan, response, retryStrategy, succeed, succeeded, timeout, timeoutElapsedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecode, encodeabsoluteTimeout, cancel, cancellationReason, cancelled, completed, context, createdAt, fail, failed, id, idempotent, name, requestSpan, response, retryStrategy, succeed, succeeded, timeout, timeoutElapsedprotected BaseKeyValueRequest(Duration timeout, CoreContext ctx, RetryStrategy retryStrategy, String key, CollectionIdentifier collectionIdentifier)
protected BaseKeyValueRequest(Duration timeout, CoreContext ctx, RetryStrategy retryStrategy, String key, CollectionIdentifier collectionIdentifier, RequestSpan span)
public static int nextOpaque()
public short partition()
KeyValueRequestpartition in interface KeyValueRequest<R extends Response>public void partition(short partition)
KeyValueRequestpartition in interface KeyValueRequest<R extends Response>partition - the partition to set.protected com.couchbase.client.core.deps.io.netty.buffer.ByteBuf encodedKeyWithCollection(com.couchbase.client.core.deps.io.netty.buffer.ByteBufAllocator alloc,
KeyValueChannelContext ctx)
Note that it uses the key set during construction, if you want to encode a different key use the
encodedExternalKeyWithCollection(ByteBufAllocator, KeyValueChannelContext, byte[]) method instead.
alloc - the buffer allocator to use.ctx - the channel context.protected com.couchbase.client.core.deps.io.netty.buffer.ByteBuf encodedExternalKeyWithCollection(com.couchbase.client.core.deps.io.netty.buffer.ByteBufAllocator alloc,
KeyValueChannelContext ctx,
byte[] key)
alloc - the buffer allocator to use.ctx - the channel context.key - the key to encode with collection id.public ServiceType serviceType()
RequestserviceType in interface Request<R extends Response>public int opaque()
opaque in interface KeyValueRequest<R extends Response>public Map<String,Object> serviceContext()
RequestserviceContext in interface Request<R extends Response>serviceContext in class BaseRequest<R extends Response>public byte[] key()
KeyValueRequestkey in interface KeyValueRequest<R extends Response>public String bucket()
bucket in interface ScopedRequestpublic CollectionIdentifier collectionIdentifier()
collectionIdentifier in interface KeyValueRequest<R extends Response>public String operationId()
RequestNote: 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).
operationId in interface Request<R extends Response>Copyright © 2021 Couchbase, Inc.. All rights reserved.