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,
InternalSpan span) |
Modifier and Type | Method and Description |
---|---|
String |
bucket() |
CollectionIdentifier |
collectionIdentifier() |
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.
|
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, internalSpan, response, retryStrategy, succeed, succeeded, timeout, timeoutElapsed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode
absoluteTimeout, cancel, cancellationReason, cancelled, completed, context, createdAt, fail, failed, id, idempotent, internalSpan, response, retryStrategy, succeed, succeeded, timeout, timeoutElapsed
protected BaseKeyValueRequest(Duration timeout, CoreContext ctx, RetryStrategy retryStrategy, String key, CollectionIdentifier collectionIdentifier)
protected BaseKeyValueRequest(Duration timeout, CoreContext ctx, RetryStrategy retryStrategy, String key, CollectionIdentifier collectionIdentifier, InternalSpan span)
public static int nextOpaque()
public short partition()
KeyValueRequest
partition
in interface KeyValueRequest<R extends Response>
public void partition(short partition)
KeyValueRequest
partition
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)
alloc
- the buffer allocator to use.ctx
- the channel context.public ServiceType serviceType()
Request
serviceType
in interface Request<R extends Response>
public int opaque()
opaque
in interface KeyValueRequest<R extends Response>
public Map<String,Object> serviceContext()
Request
serviceContext
in interface Request<R extends Response>
serviceContext
in class BaseRequest<R extends Response>
public byte[] key()
KeyValueRequest
key
in interface KeyValueRequest<R extends Response>
public String bucket()
bucket
in interface ScopedRequest
public CollectionIdentifier collectionIdentifier()
collectionIdentifier
in interface KeyValueRequest<R extends Response>
public String operationId()
Request
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).
operationId
in interface Request<R extends Response>
Copyright © 2020 Couchbase, Inc.. All rights reserved.