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 Details

  • Method Details

    • nextOpaque

      public static int nextOpaque()
    • partition

      public short partition()
      Description copied from interface: KeyValueRequest
      Reads the currently set partition this request is targeted against.
      Specified by:
      partition in interface KeyValueRequest<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 interface KeyValueRequest<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

      public ServiceType serviceType()
      Description copied from interface: Request
      The service type of this request.
      Specified by:
      serviceType in interface Request<R extends Response>
      Returns:
      the service type for this request.
    • opaque

      public int opaque()
      Specified by:
      opaque in interface KeyValueRequest<R extends Response>
    • serviceContext

      public Map<String,​Object> serviceContext()
      Description copied from interface: Request
      Returns contextual information for each individual service.
      Specified by:
      serviceContext in interface Request<R extends Response>
      Overrides:
      serviceContext in class BaseRequest<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 interface KeyValueRequest<R extends Response>
      Returns:
      the key of the request.
    • bucket

      public String bucket()
      Specified by:
      bucket in interface ScopedRequest
    • collectionIdentifier

      public CollectionIdentifier collectionIdentifier()
      Specified by:
      collectionIdentifier in interface KeyValueRequest<R extends Response>
    • operationId

      public String operationId()
      Description copied from interface: Request
      Returns 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:
      operationId in interface Request<R extends Response>
      Returns:
      if present, the operation id. Null otherwise.