@Stability.Volatile public class ProtostellarBaseRequest extends Object implements Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
Request
, create one dynamically.Constructor and Description |
---|
ProtostellarBaseRequest(CoreProtostellar core,
ProtostellarRequest<?> request) |
Modifier and Type | Method and Description |
---|---|
long |
absoluteTimeout()
The absolute timestamp when the request should time out.
|
void |
cancel(CancellationReason reason,
Function<Throwable,Throwable> exceptionTranslator)
Cancels this request, allowing the caller to customize the exception.
|
CancellationReason |
cancellationReason()
If the request is
Request.cancelled() , this returns the reason why. |
boolean |
cancelled()
Allows to check if this request has been cancelled before it got a chance
to be either failed or succeeded.
|
boolean |
completed()
Allows to check if this request is completed already.
|
RequestContext |
context()
If attached, returns the context for this request.
|
long |
createdAt()
Holds the nanoTime when the request got created.
|
void |
fail(Throwable error)
Fails this request and completes it.
|
boolean |
failed()
Allows to check if this request has been completed but with an exception.
|
long |
id()
Holds a unique ID for each request that is assigned automatically.
|
RequestSpan |
requestSpan()
Holds the internal span for this request.
|
CompletableFuture<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse> |
response()
Holds the response which eventually completes.
|
RetryStrategy |
retryStrategy()
The retry strategy for this particular request.
|
Map<String,Object> |
serviceContext()
Returns contextual information for each individual service.
|
ServiceType |
serviceType()
The service type of this request.
|
void |
succeed(com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse result)
Completes this request successfully.
|
boolean |
succeeded()
Allows to check if this request has been successfully completed.
|
Duration |
timeout()
Returns the timeout for this request.
|
boolean |
timeoutElapsed()
Returns true if the timeout elapsed.
|
void |
timeoutRegistration(com.couchbase.client.core.deps.io.netty.util.Timeout registration)
Sets the timeout registration used to cancel when complete.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bucket, cancel, idempotent, name, operationId, target
@Stability.Internal public ProtostellarBaseRequest(CoreProtostellar core, ProtostellarRequest<?> request)
public long id()
Request
public CompletableFuture<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse> response()
Request
public void succeed(com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse result)
Request
public void fail(Throwable error)
Request
public void cancel(CancellationReason reason, Function<Throwable,Throwable> exceptionTranslator)
Request
public void timeoutRegistration(com.couchbase.client.core.deps.io.netty.util.Timeout registration)
Request
timeoutRegistration
in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
registration
- the registration for the timeout timer.public RequestContext context()
Request
public Duration timeout()
Request
public boolean timeoutElapsed()
Request
timeoutElapsed
in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
public boolean completed()
Request
public boolean succeeded()
Request
public boolean failed()
Request
public boolean cancelled()
Request
public CancellationReason cancellationReason()
Request
Request.cancelled()
, this returns the reason why.cancellationReason
in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
public ServiceType serviceType()
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.
serviceType
in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
public Map<String,Object> serviceContext()
Request
serviceContext
in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
public RetryStrategy retryStrategy()
Request
retryStrategy
in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
public RequestSpan requestSpan()
Request
requestSpan
in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
public long createdAt()
Request
public long absoluteTimeout()
Request
absoluteTimeout
in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
Copyright © 2024 Couchbase, Inc.. All rights reserved.