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
,DecrementRequest
,GetAndLockRequest
,GetAndTouchRequest
,GetCollectionIdRequest
,GetCollectionManifestRequest
,GetRequest
,IncrementRequest
,InsertRequest
,NoopRequest
,ObserveViaCasRequest
,ObserveViaSeqnoRequest
,PrependRequest
,RemoveRequest
,ReplaceRequest
,SubdocGetRequest
,SubdocMutateRequest
,TouchRequest
,UnlockRequest
,UpsertRequest
public abstract class BaseKeyValueRequest<R extends Response> extends BaseRequest<R> implements KeyValueRequest<R>
TheBaseKeyValueRequest
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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, ChannelContext 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.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.-
Methods inherited from class com.couchbase.client.core.msg.BaseRequest
cancel, cancellationReason, cancelled, completed, context, fail, failed, id, response, retryStrategy, succeed, succeeded, timeout
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.couchbase.client.core.msg.kv.KeyValueRequest
decode, encode
-
-
-
-
Method Detail
-
partition
public short partition()
Description copied from interface:KeyValueRequest
Reads the currently set partition this request is targeted against.- Specified by:
partition
in interfaceKeyValueRequest<R extends Response>
-
partition
public void partition(short partition)
Description copied from interface:KeyValueRequest
Allows to set the partition used for this request.- Specified by:
partition
in 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, ChannelContext 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
public ServiceType serviceType()
Description copied from interface:Request
The service type of this request.- Specified by:
serviceType
in interfaceRequest<R extends Response>
- Returns:
- the service type for this request.
-
serviceContext
public Map<String,Object> serviceContext()
Description copied from interface:Request
Returns contextual information for each individual service.- Specified by:
serviceContext
in interfaceRequest<R extends Response>
- Overrides:
serviceContext
in classBaseRequest<R extends Response>
- Returns:
- the service context.
-
key
public byte[] key()
Description copied from interface:KeyValueRequest
The key of the kv request.- Specified by:
key
in interfaceKeyValueRequest<R extends Response>
- Returns:
- the key of the request.
-
bucket
public String bucket()
- Specified by:
bucket
in interfaceScopedRequest
-
collectionIdentifier
public CollectionIdentifier collectionIdentifier()
- Specified by:
collectionIdentifier
in interfaceKeyValueRequest<R extends Response>
-
-