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 Details

  • Constructor Details

    • AbstractKeyValueRequest

      protected AbstractKeyValueRequest​(String key, String bucket)
      Parameters:
      key - the key of the document.
      bucket - the bucket of the document.
    • AbstractKeyValueRequest

      protected AbstractKeyValueRequest​(String key, String bucket, String password)
      Parameters:
      key - the key of the document.
      bucket - the bucket of the document.
      password - the password for the bucket.
    • AbstractKeyValueRequest

      protected AbstractKeyValueRequest​(String key, String bucket, String username, String password)
      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)
      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 class AbstractCouchbaseRequest
    • key

      public String key()
      Description copied from interface: BinaryRequest
      The key of the document.
      Specified by:
      key in interface BinaryRequest
      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 interface BinaryRequest
      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 interface BinaryRequest
      Returns:
      the partition to use.
    • partition

      public BinaryRequest partition​(short partition)
      Description copied from interface: BinaryRequest
      Set the partition ID.
      Specified by:
      partition in interface BinaryRequest
      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 interface BinaryRequest
      Returns:
      an automatically generated opaque value.
    • operationId

      public String operationId()
      Description copied from class: AbstractCouchbaseRequest
      Default implementation, sub requests need to override this.
      Specified by:
      operationId in interface CouchbaseRequest
      Overrides:
      operationId in class AbstractCouchbaseRequest
      Returns:
      the operation id or null.
    • hasSeenNotMyVbucket

      public boolean hasSeenNotMyVbucket()
      Description copied from interface: BinaryRequest
      Returns true if this operation has been rejected at least once because of a KV not my vbucket operation.
      Specified by:
      hasSeenNotMyVbucket in interface BinaryRequest
      Returns:
      true if it has seen it, false otherwise.
    • sawNotMyVbucket

      public void sawNotMyVbucket()
      Description copied from interface: BinaryRequest
      This method should be called if during response parsing, a NMVB response got returned from the server.
      Specified by:
      sawNotMyVbucket in interface BinaryRequest