Class AbstractKeyValueRequest
java.lang.Object
com.couchbase.client.core.message.AbstractCouchbaseRequest
com.couchbase.client.core.message.kv.AbstractKeyValueRequest
- All Implemented Interfaces:
CouchbaseMessage
,CouchbaseRequest
,BinaryRequest
- Direct Known Subclasses:
AbstractSubdocRequest
,AppendRequest
,CounterRequest
,GetAllMutationTokensRequest
,GetBucketConfigRequest
,GetRequest
,InsertRequest
,KeyValueHandler.KeepAliveRequest
,NoopRequest
,ObserveRequest
,ObserveSeqnoRequest
,PrependRequest
,RemoveRequest
,ReplaceRequest
,ReplicaGetRequest
,StatRequest
,SubMultiLookupRequest
,SubMultiMutationRequest
,TouchRequest
,UnlockRequest
,UpsertRequest
public abstract class AbstractKeyValueRequest extends AbstractCouchbaseRequest implements BinaryRequest
Default implementation of a
BinaryRequest
.- Since:
- 1.0
- Author:
- Michael Nitschinger
-
Field Summary
Fields Modifier and Type Field Description protected static short
DEFAULT_PARTITION
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractKeyValueRequest(String key, String bucket)
Creates a newAbstractKeyValueRequest
.protected
AbstractKeyValueRequest(String key, String bucket, String password)
Creates a newAbstractKeyValueRequest
.protected
AbstractKeyValueRequest(String key, String bucket, String username, String password)
Creates a newAbstractKeyValueRequest
.protected
AbstractKeyValueRequest(String key, String bucket, String username, String password, rx.subjects.Subject<CouchbaseResponse,CouchbaseResponse> observable)
Creates a newAbstractKeyValueRequest
. -
Method Summary
Modifier and Type Method Description protected void
afterSpanSet(io.opentracing.Span span)
Use this method to add custom span values on insert.String
key()
The key of the document.byte[]
keyBytes()
The raw byte representation of the key.int
opaque()
A opaque value representing this request.String
operationId()
Default implementation, sub requests need to override this.short
partition()
The partition (vbucket) to use for this request.BinaryRequest
partition(short partition)
Set the partition ID.Methods inherited from class com.couchbase.client.core.message.AbstractCouchbaseRequest
bucket, complete, creationTime, dispatchHostname, dispatchHostname, emit, fail, incrementRetryCount, isActive, lastLocalId, lastLocalId, lastLocalSocket, lastLocalSocket, lastRemoteSocket, lastRemoteSocket, maxRetryDuration, maxRetryDuration, observable, password, retryAfter, retryAfter, retryCount, retryDelay, retryDelay, span, span, subscriber, succeed, toString, username
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.couchbase.client.core.message.CouchbaseMessage
creationTime
Methods inherited from interface com.couchbase.client.core.message.CouchbaseRequest
bucket, complete, dispatchHostname, dispatchHostname, emit, fail, incrementRetryCount, isActive, lastLocalId, lastLocalId, lastLocalSocket, lastLocalSocket, lastRemoteSocket, lastRemoteSocket, maxRetryDuration, maxRetryDuration, observable, password, retryAfter, retryAfter, retryCount, retryDelay, retryDelay, span, span, subscriber, succeed, username
-
Field Details
-
DEFAULT_PARTITION
protected static final short DEFAULT_PARTITION- See Also:
- Constant Field Values
-
-
Constructor Details
-
AbstractKeyValueRequest
Creates a newAbstractKeyValueRequest
.- Parameters:
key
- the key of the document.bucket
- the bucket of the document.
-
AbstractKeyValueRequest
Creates a newAbstractKeyValueRequest
.- Parameters:
key
- the key of the document.bucket
- the bucket of the document.password
- the password for the bucket.
-
AbstractKeyValueRequest
Creates a newAbstractKeyValueRequest
.- Parameters:
key
- the key of the document.bucket
- the bucket of the document.username
- the user authorized for bucket access.password
- the password for the user.
-
AbstractKeyValueRequest
protected AbstractKeyValueRequest(String key, String bucket, String username, String password, rx.subjects.Subject<CouchbaseResponse,CouchbaseResponse> observable)Creates a newAbstractKeyValueRequest
.- Parameters:
key
- the key of the document.bucket
- the bucket of the document.username
- the user authorized for bucket access.password
- the optional password of the user.observable
- the observable which receives responses.
-
-
Method Details
-
afterSpanSet
protected void afterSpanSet(io.opentracing.Span span)Description copied from class:AbstractCouchbaseRequest
Use this method to add custom span values on insert.- Overrides:
afterSpanSet
in classAbstractCouchbaseRequest
-
key
Description copied from interface:BinaryRequest
The key of the document.- Specified by:
key
in interfaceBinaryRequest
- Returns:
- the key of the document, if set.
-
keyBytes
public byte[] keyBytes()Description copied from interface:BinaryRequest
The raw byte representation of the key.- Specified by:
keyBytes
in interfaceBinaryRequest
- Returns:
- the bytes of the key.
-
partition
public short partition()Description copied from interface:BinaryRequest
The partition (vbucket) to use for this request.- Specified by:
partition
in interfaceBinaryRequest
- Returns:
- the partition to use.
-
partition
Description copied from interface:BinaryRequest
Set the partition ID.- Specified by:
partition
in interfaceBinaryRequest
- Parameters:
partition
- the id of the partition.- Returns:
- the
BinaryRequest
for proper chaining.
-
opaque
public int opaque()Description copied from interface:BinaryRequest
A opaque value representing this request.- Specified by:
opaque
in interfaceBinaryRequest
- Returns:
- an automatically generated opaque value.
-
operationId
Description copied from class:AbstractCouchbaseRequest
Default implementation, sub requests need to override this.- Specified by:
operationId
in interfaceCouchbaseRequest
- Overrides:
operationId
in classAbstractCouchbaseRequest
- Returns:
- the operation id or null.
-