pub struct TransportConfig {Show 13 fields
pub DefaultTimeout: Duration,
pub MaximumRetries: u32,
pub RetryBaseDelay: Duration,
pub RetryMaximumDelay: Duration,
pub RetryJitterEnabled: bool,
pub CircuitBreakerFailureThreshold: u32,
pub CircuitBreakerResetTimeout: Duration,
pub HealthChecksEnabled: bool,
pub HealthCheckInterval: Duration,
pub MetricsEnabled: bool,
pub TransportConfigurations: HashMap<TransportType, Value>,
pub AllowedTransports: Vec<TransportType>,
pub ForbiddenTransports: Vec<TransportType>,
}Expand description
Global transport configuration.
Fields§
§DefaultTimeout: DurationDefault timeout for requests that don’t specify one.
MaximumRetries: u32Maximum number of retry attempts for retryable errors.
RetryBaseDelay: DurationBase retry delay for exponential backoff.
RetryMaximumDelay: DurationMaximum retry delay cap (prevents extremely long backoffs).
RetryJitterEnabled: boolWhether retry with jitter is enabled (recommended for distributed systems).
CircuitBreakerFailureThreshold: u32Circuit breaker failure threshold (number of consecutive failures before opening).
CircuitBreakerResetTimeout: DurationCircuit breaker reset timeout (how long to wait before half-open).
HealthChecksEnabled: boolWhether health checks are enabled.
HealthCheckInterval: DurationHealth check interval (how often to perform health checks).
MetricsEnabled: boolMetrics collection enabled flag.
TransportConfigurations: HashMap<TransportType, Value>Transport-specific configuration overrides.
AllowedTransports: Vec<TransportType>Allowed transport types for auto-selection.
ForbiddenTransports: Vec<TransportType>Forbidden transport types (never used even if available).
Implementations§
Source§impl TransportConfig
impl TransportConfig
Sourcepub fn WithDefaultTimeout(self, Timeout: Duration) -> Self
pub fn WithDefaultTimeout(self, Timeout: Duration) -> Self
Sets the default request timeout.
Sourcepub fn WithMaximumRetries(self, MaximumRetries: u32) -> Self
pub fn WithMaximumRetries(self, MaximumRetries: u32) -> Self
Sets the maximum number of retry attempts.
Sourcepub fn WithRetryBaseDelay(self, Delay: Duration) -> Self
pub fn WithRetryBaseDelay(self, Delay: Duration) -> Self
Sets the base retry delay for exponential backoff.
Sourcepub fn WithRetryMaximumDelay(self, Delay: Duration) -> Self
pub fn WithRetryMaximumDelay(self, Delay: Duration) -> Self
Sets the maximum retry delay cap.
Sourcepub fn WithRetryJitter(self, Enabled: bool) -> Self
pub fn WithRetryJitter(self, Enabled: bool) -> Self
Enables or disables retry jitter.
Sourcepub fn WithCircuitBreakerThreshold(self, Threshold: u32) -> Self
pub fn WithCircuitBreakerThreshold(self, Threshold: u32) -> Self
Sets the circuit breaker failure threshold.
Sourcepub fn WithCircuitBreakerResetTimeout(self, Timeout: Duration) -> Self
pub fn WithCircuitBreakerResetTimeout(self, Timeout: Duration) -> Self
Sets the circuit breaker reset timeout.
Sourcepub fn WithHealthChecksEnabled(self, Enabled: bool) -> Self
pub fn WithHealthChecksEnabled(self, Enabled: bool) -> Self
Enables or disables health checks.
Sourcepub fn WithHealthCheckInterval(self, Interval: Duration) -> Self
pub fn WithHealthCheckInterval(self, Interval: Duration) -> Self
Sets the health check interval.
Sourcepub fn WithMetricsEnabled(self, Enabled: bool) -> Self
pub fn WithMetricsEnabled(self, Enabled: bool) -> Self
Enables or disables metrics collection.
Sourcepub fn WithTransportConfiguration(
self,
TransportKind: TransportType,
Configuration: Value,
) -> Self
pub fn WithTransportConfiguration( self, TransportKind: TransportType, Configuration: Value, ) -> Self
Adds a transport-specific configuration override.
Sourcepub fn GetTransportConfiguration(
&self,
TransportKind: TransportType,
) -> Option<&Value>
pub fn GetTransportConfiguration( &self, TransportKind: TransportType, ) -> Option<&Value>
Gets the transport-specific configuration for the given type, if any.
Sourcepub fn WithAllowedTransports(self, Transports: Vec<TransportType>) -> Self
pub fn WithAllowedTransports(self, Transports: Vec<TransportType>) -> Self
Sets the allowed transport types for auto-selection.
Sourcepub fn AddForbiddenTransport(self, TransportKind: TransportType) -> Self
pub fn AddForbiddenTransport(self, TransportKind: TransportType) -> Self
Adds a forbidden transport type.
Sourcepub fn WithForbiddenTransport(self, TransportKind: TransportType) -> Self
pub fn WithForbiddenTransport(self, TransportKind: TransportType) -> Self
Alias for AddForbiddenTransport.
Sourcepub fn IsAllowed(&self, TransportKind: TransportType) -> bool
pub fn IsAllowed(&self, TransportKind: TransportType) -> bool
Checks if a transport type is allowed by this configuration.
Sourcepub fn EffectiveTimeout(
&self,
RequestTimeoutMilliseconds: Option<u64>,
) -> Duration
pub fn EffectiveTimeout( &self, RequestTimeoutMilliseconds: Option<u64>, ) -> Duration
Gets the effective timeout for a request, considering request-specific overrides.
Sourcepub fn EffectiveRetryDelay(&self, Attempt: u32) -> Duration
pub fn EffectiveRetryDelay(&self, Attempt: u32) -> Duration
Gets the effective retry delay for a given attempt number, considering jitter.
Trait Implementations§
Source§impl Clone for TransportConfig
impl Clone for TransportConfig
Source§fn clone(&self) -> TransportConfig
fn clone(&self) -> TransportConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more