Class ProtostellarBaseRequest

java.lang.Object
com.couchbase.client.core.protostellar.ProtostellarBaseRequest
All Implemented Interfaces:
Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>

@Volatile public class ProtostellarBaseRequest extends Object implements Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
Where the public API requires a Request, create one dynamically.
  • Constructor Details

  • Method Details

    • id

      public long id()
      Description copied from interface: Request
      Holds a unique ID for each request that is assigned automatically.
      Specified by:
      id in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the unique request ID.
    • response

      public CompletableFuture<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse> response()
      Description copied from interface: Request
      Holds the response which eventually completes.
      Specified by:
      response in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the future containing the response, eventually.
    • succeed

      public void succeed(com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse result)
      Description copied from interface: Request
      Completes this request successfully.
      Specified by:
      succeed in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Parameters:
      result - the result to complete with.
    • fail

      public void fail(Throwable error)
      Description copied from interface: Request
      Fails this request and completes it.
      Specified by:
      fail in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Parameters:
      error - the error to fail this request with.
    • cancel

      public void cancel(CancellationReason reason, Function<Throwable,Throwable> exceptionTranslator)
      Description copied from interface: Request
      Cancels this request, allowing the caller to customize the exception.
      Specified by:
      cancel in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      exceptionTranslator - A typical function might create a new custom exception using the argument as the cause.
    • timeoutRegistration

      public void timeoutRegistration(com.couchbase.client.core.deps.io.netty.util.Timeout registration)
      Description copied from interface: Request
      Sets the timeout registration used to cancel when complete.
      Specified by:
      timeoutRegistration in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Parameters:
      registration - the registration for the timeout timer.
    • context

      public RequestContext context()
      Description copied from interface: Request
      If attached, returns the context for this request.
      Specified by:
      context in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the request context if attached.
    • timeout

      public Duration timeout()
      Description copied from interface: Request
      Returns the timeout for this request.
      Specified by:
      timeout in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the timeout for this request.
    • timeoutElapsed

      public boolean timeoutElapsed()
      Description copied from interface: Request
      Returns true if the timeout elapsed.
      Specified by:
      timeoutElapsed in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
    • completed

      public boolean completed()
      Description copied from interface: Request
      Allows to check if this request is completed already.
      Specified by:
      completed in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      true if completed, failed or cancelled.
    • succeeded

      public boolean succeeded()
      Description copied from interface: Request
      Allows to check if this request has been successfully completed.
      Specified by:
      succeeded in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      true if succeeded, false otherwise.
    • failed

      public boolean failed()
      Description copied from interface: Request
      Allows to check if this request has been completed but with an exception.
      Specified by:
      failed in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      true if failed, false otherwise.
    • cancelled

      public boolean cancelled()
      Description copied from interface: Request
      Allows to check if this request has been cancelled before it got a chance to be either failed or succeeded.
      Specified by:
      cancelled in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      true if cancelled, false otherwise.
    • cancellationReason

      public CancellationReason cancellationReason()
      Description copied from interface: Request
      If the request is Request.cancelled(), this returns the reason why.
      Specified by:
      cancellationReason in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the cancellation reason if cancelled, null otherwise.
    • serviceType

      public ServiceType serviceType()
      Description copied from interface: Request
      The service type of this request.

      Can be null if this is a 'virtual service' (e.g. transactions), which don't map 1:1 to a particular cluster service, but need to integrate into various codepaths that are built around ServiceType such as ThresholdLoggingTracer. Virtual requests must not be sent into core at present, as there is limited support for them.

      Specified by:
      serviceType in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      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 interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the service context.
    • retryStrategy

      public RetryStrategy retryStrategy()
      Description copied from interface: Request
      The retry strategy for this particular request.
      Specified by:
      retryStrategy in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the retry strategy for this request.
    • requestSpan

      public RequestSpan requestSpan()
      Description copied from interface: Request
      Holds the internal span for this request.
      Specified by:
      requestSpan in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the internal span used for the request.
    • createdAt

      public long createdAt()
      Description copied from interface: Request
      Holds the nanoTime when the request got created.
      Specified by:
      createdAt in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the time when the request got created.
    • absoluteTimeout

      public long absoluteTimeout()
      Description copied from interface: Request
      The absolute timestamp when the request should time out.
      Specified by:
      absoluteTimeout in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
      Returns:
      the absolute timeout in nanoseconds.