pub struct StreamConfig {
pub reliability: Reliability,
pub window_bytes: u32,
pub fairness_weight: u8,
pub scheduled: bool,
pub close_behavior: CloseBehavior,
}Expand description
Per-stream configuration supplied at open_stream time.
Configuration is immutable for the lifetime of a stream. Re-opening
the same (peer, stream_id) with different config is a no-op with
a warning log — the original config wins.
Fields§
§reliability: ReliabilityReliability mode. Defaults to FireAndForget.
window_bytes: u32Initial credit window for the stream’s send path, in bytes.
The sender starts with tx_credit_remaining = window_bytes and
decrements on each socket send; receiver-driven StreamWindow
grants replenish the counter. 0 disables backpressure
(unbounded — v1 escape hatch). Defaults to
DEFAULT_STREAM_WINDOW_BYTES.
fairness_weight: u8Fair-scheduler quantum multiplier. 1 is equal-share; higher
means this stream gets proportionally more packets per round.
scheduled: boolRoute this stream’s originating sends through the router’s
FairScheduler
rather than straight to the socket. Default false — every
existing caller (nRPC streaming, control traffic) keeps the
direct socket.send_to path. Set true for bulk transfers so
their sends participate in per-stream weighted fairness and
can’t monopolize the link against other scheduled streams. The
scheduler’s queue depth becomes an additional backpressure
source (surfaced as StreamError::Backpressure).
close_behavior: CloseBehaviorWhat to do with pending outbound packets on close.
Implementations§
Source§impl StreamConfig
impl StreamConfig
Sourcepub fn with_reliability(self, reliability: Reliability) -> Self
pub fn with_reliability(self, reliability: Reliability) -> Self
Set the reliability mode.
Sourcepub fn with_window_bytes(self, bytes: u32) -> Self
pub fn with_window_bytes(self, bytes: u32) -> Self
Set the per-stream window (queue depth cap).
Sourcepub fn with_fairness_weight(self, weight: u8) -> Self
pub fn with_fairness_weight(self, weight: u8) -> Self
Set the fair-scheduler weight (1 = equal share; higher = more).
Sourcepub fn with_scheduled(self, scheduled: bool) -> Self
pub fn with_scheduled(self, scheduled: bool) -> Self
Route this stream’s originating sends through the router’s
fair scheduler (see Self::scheduled). Use for bulk transfers.
Sourcepub fn with_close_behavior(self, behavior: CloseBehavior) -> Self
pub fn with_close_behavior(self, behavior: CloseBehavior) -> Self
Set the close behavior.
Trait Implementations§
Source§impl Clone for StreamConfig
impl Clone for StreamConfig
Source§fn clone(&self) -> StreamConfig
fn clone(&self) -> StreamConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more