pub struct ReqOptions {
pub conn: ConnOptions,
pub timeout: Duration,
pub blocking_connect: bool,
pub min_compress_size: usize,
pub write_buffer_size: usize,
pub write_buffer_linger: Option<Duration>,
pub max_queue_size: usize,
pub max_pending_requests: usize,
}Expand description
The request socket options.
Fields§
§conn: ConnOptionsOptions for the connection manager.
timeout: DurationTimeout duration for requests.
blocking_connect: boolWether to block on initial connection to the target.
min_compress_size: usizeMinimum payload size in bytes for compression to be used. If the payload is smaller than this threshold, it will not be compressed.
write_buffer_size: usizeThe size of the write buffer in bytes.
write_buffer_linger: Option<Duration>The linger duration for the write buffer (how long to wait before flushing).
max_queue_size: usizeThe size of the channel buffer between the socket and the driver.
This controls how many requests can be queued, on top of the current pending requests,
before the socket returns ReqError::HighWaterMarkReached.
max_pending_requests: usizeHigh-water mark for pending requests. When this limit is reached, new requests
will not be processed and will be queued up to max_queue_size
elements. Once both limits are reached, new requests will return
ReqError::HighWaterMarkReached.
Implementations§
Source§impl ReqOptions
impl ReqOptions
Sourcepub fn low_latency() -> Self
pub fn low_latency() -> Self
Creates options optimized for low latency.
Sourcepub fn high_throughput() -> Self
pub fn high_throughput() -> Self
Creates options optimized for high throughput.
Source§impl ReqOptions
impl ReqOptions
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets the timeout for the socket.
Sourcepub fn with_blocking_connect(self) -> Self
pub fn with_blocking_connect(self) -> Self
Enables blocking initial connections to the target.
Sourcepub fn with_backoff_duration(self, backoff_duration: Duration) -> Self
pub fn with_backoff_duration(self, backoff_duration: Duration) -> Self
Sets the backoff duration for the socket.
Sourcepub fn with_retry_attempts(self, retry_attempts: usize) -> Self
pub fn with_retry_attempts(self, retry_attempts: usize) -> Self
Sets the maximum number of retry attempts.
If None, all connections will be retried indefinitely.
Sourcepub fn with_min_compress_size(self, min_compress_size: usize) -> Self
pub fn with_min_compress_size(self, min_compress_size: usize) -> Self
Sets the minimum payload size in bytes for compression to be used.
If the payload is smaller than this threshold, it will not be compressed.
Default: DEFAULT_BUFFER_SIZE
Sourcepub fn with_write_buffer_size(self, size: usize) -> Self
pub fn with_write_buffer_size(self, size: usize) -> Self
Sets the size (max capacity) of the write buffer in bytes. When the buffer is full, it will be flushed to the underlying transport.
Default: DEFAULT_BUFFER_SIZE
Sourcepub fn with_write_buffer_linger(self, duration: Option<Duration>) -> Self
pub fn with_write_buffer_linger(self, duration: Option<Duration>) -> Self
Sets the linger duration for the write buffer. If None, the write buffer will only be
flushed when the buffer is full.
Default: 100µs
Sourcepub fn with_max_queue_size(self, size: usize) -> Self
pub fn with_max_queue_size(self, size: usize) -> Self
Sets the size of the channel buffer between the socket and the driver.
This controls how many requests can be queued, on top of the current pending requests,
before the socket returns ReqError::HighWaterMarkReached.
Default: DEFAULT_QUEUE_SIZE
Sourcepub fn with_max_pending_requests(self, hwm: usize) -> Self
pub fn with_max_pending_requests(self, hwm: usize) -> Self
Sets the high-water mark for pending requests. When this limit is reached, new requests
will not be processed and will be queued up to Self::with_max_queue_size elements.
Once both limits are reached, new requests will return ReqError::HighWaterMarkReached.
Default: DEFAULT_QUEUE_SIZE
Trait Implementations§
Source§impl Clone for ReqOptions
impl Clone for ReqOptions
Source§fn clone(&self) -> ReqOptions
fn clone(&self) -> ReqOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more