Class ProtostellarRequest<TGrpcRequest>
- java.lang.Object
-
- com.couchbase.client.core.protostellar.ProtostellarRequest<TGrpcRequest>
-
- Direct Known Subclasses:
ProtostellarCollectionManagerRequest,ProtostellarKeyValueRequest
@Internal public class ProtostellarRequest<TGrpcRequest> extends Object
Holds onto a GRPC request, along with pertaining mutable and immutable state bound to the request's lifetime.
-
-
Field Summary
Fields Modifier and Type Field Description protected ServiceTypeserviceType
-
Constructor Summary
Constructors Constructor Description ProtostellarRequest(TGrpcRequest request, CoreProtostellar core, ServiceType serviceType, String requestName, RequestSpan span, Duration timeout, boolean readonly, RetryStrategy retryStrategy, Map<String,Object> clientContext, long encodeDurationNanos, Consumer<Map<String,Object>> contextSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longabsoluteTimeout()ProtostellarRequestBehaviourcancel(CancellationReason reason)CancellationReasoncancellationReason()booleancompleted()GenericErrorContextcontext()longcreatedAt()com.couchbase.client.core.deps.io.grpc.Deadlinedeadline()voiddispatchDuration(long durationNanos)booleanfailed()voidincrementRetryAttempts(Duration duration, RetryReason reason)longlogicalRequestLatency()voidmarkAsSent()booleanmaybeSent()voidraisedResponseToUser(Throwable err)Crucial to always ultimately call this on every request, and just once.booleanreadonly()TGrpcRequestrequest()intretryAttempts()RetryStrategyretryStrategy()ServiceTypeserviceType()RequestSpanspan()booleansucceeded()Durationtimeout()booleantimeoutElapsed()
-
-
-
Field Detail
-
serviceType
protected final ServiceType serviceType
-
-
Constructor Detail
-
ProtostellarRequest
public ProtostellarRequest(TGrpcRequest request, CoreProtostellar core, ServiceType serviceType, String requestName, RequestSpan span, Duration timeout, boolean readonly, RetryStrategy retryStrategy, Map<String,Object> clientContext, long encodeDurationNanos, @Nullable Consumer<Map<String,Object>> contextSupplier)
-
-
Method Detail
-
request
public TGrpcRequest request()
-
span
public RequestSpan span()
-
raisedResponseToUser
public void raisedResponseToUser(@Nullable Throwable err)
Crucial to always ultimately call this on every request, and just once.
-
timeout
public Duration timeout()
-
deadline
public com.couchbase.client.core.deps.io.grpc.Deadline deadline()
-
absoluteTimeout
public long absoluteTimeout()
-
retryStrategy
public RetryStrategy retryStrategy()
-
timeoutElapsed
public boolean timeoutElapsed()
-
cancel
public ProtostellarRequestBehaviour cancel(CancellationReason reason)
-
readonly
public boolean readonly()
-
logicalRequestLatency
public long logicalRequestLatency()
-
incrementRetryAttempts
public void incrementRetryAttempts(Duration duration, RetryReason reason)
-
markAsSent
public void markAsSent()
-
maybeSent
public boolean maybeSent()
-
context
public GenericErrorContext context()
-
retryAttempts
public int retryAttempts()
-
dispatchDuration
public void dispatchDuration(long durationNanos)
-
completed
public boolean completed()
-
createdAt
public long createdAt()
-
serviceType
public ServiceType serviceType()
-
cancellationReason
@Nullable public CancellationReason cancellationReason()
-
failed
public boolean failed()
-
succeeded
public boolean succeeded()
-
-