pub struct RequestSettings {
pub connect_timeout: Option<Duration>,
pub timeout: Option<Duration>,
pub retries: Option<usize>,
pub ban_failed_address: Option<bool>,
pub ban_busy_address: Option<bool>,
pub max_decoding_message_size: Option<usize>,
}Expand description
DAPI request settings.
There are four levels of settings where each next level can override all previous ones:
- Defaults for this library;
- crate::DapiClient settings;
- crate::DapiRequest-specific settings;
- settings for an exact request execution call.
Fields§
§connect_timeout: Option<Duration>Timeout for establishing a connection.
timeout: Option<Duration>Timeout for a single request attempt.
It is sent to the server as the grpc-timeout header. On native targets
it also bounds the whole attempt on the client: an attempt still running
after timeout + connect_timeout fails with DeadlineExceeded and is
retried like any other retryable error (through a proxy without a
connect_timeout, the proxy’s 20-second connect default counts as the
connect_timeout here). For unary RPCs the attempt runs
from dispatch through the response body and trailers; for streaming
RPCs it ends when the response headers arrive, so consuming the
returned stream is not bounded by it. Zero disables both limits.
Note that the total maximum time of execution can exceed (timeout + connect_timeout) * retries
as it accounts for internal processing time between retries.
retries: Option<usize>Number of retries in case of failed requests. If max retries reached, the last error is returned. 1 means one request and one retry in case of error, etc.
ban_failed_address: Option<bool>Ban DAPI address if node not responded or responded with error.
ban_busy_address: Option<bool>Ban a DAPI address whose node answered that it is busy or rate limited (gRPC
ResourceExhausted), or that what was asked is not ready yet (gRPC Unavailable
with a retry-after header).
Such a node is working. A request to a method with a tight limit of its own sets this
to false: the request then moves to another node, and this one stays available to
every other request. Every other failure is still banned as
ban_failed_address says, which also turns this off when
it is false.
max_decoding_message_size: Option<usize>Maximum gRPC response size in bytes (decoding limit).
Implementations§
Source§impl RequestSettings
impl RequestSettings
Sourcepub const fn default() -> Self
pub const fn default() -> Self
Create empty RequestSettings, which means no overrides will be applied.
Actually does the same as Default, but it’s const.
Sourcepub fn override_by(self, rhs: RequestSettings) -> Self
pub fn override_by(self, rhs: RequestSettings) -> Self
Combines two instances of RequestSettings with following rules:
Sourcepub fn finalize(self) -> AppliedRequestSettings
pub fn finalize(self) -> AppliedRequestSettings
Fill in settings defaults.
Trait Implementations§
Source§impl Clone for RequestSettings
impl Clone for RequestSettings
impl Copy for RequestSettings
Source§impl Debug for RequestSettings
impl Debug for RequestSettings
Auto Trait Implementations§
impl Freeze for RequestSettings
impl RefUnwindSafe for RequestSettings
impl Send for RequestSettings
impl Sync for RequestSettings
impl Unpin for RequestSettings
impl UnsafeUnpin for RequestSettings
impl UnwindSafe for RequestSettings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
§fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].