pub struct ReliableStream { /* private fields */ }Expand description
Reliable stream mode with selective NACKs.
Features:
- Bounded retransmit window (32 packets)
- Selective NACKs (receiver-driven)
- Per-stream state
- Configurable RTO
Suitable for:
- Tool call results
- Guardrail decisions
- Session lifecycle events
- Error propagation
Implementations§
Source§impl ReliableStream
impl ReliableStream
Sourcepub const DEFAULT_RTO: Duration
pub const DEFAULT_RTO: Duration
Default retransmit timeout
Sourcepub const DEFAULT_MAX_PENDING: usize = 32
pub const DEFAULT_MAX_PENDING: usize = 32
Default max pending packets
Sourcepub const DEFAULT_MAX_RETRIES: u8 = 3
pub const DEFAULT_MAX_RETRIES: u8 = 3
Default max retries
Sourcepub fn with_settings(rto: Duration, max_pending: usize, max_retries: u8) -> Self
pub fn with_settings(rto: Duration, max_pending: usize, max_retries: u8) -> Self
Create with custom settings
Sourcepub fn untracked_evictions(&self) -> u64
pub fn untracked_evictions(&self) -> u64
Number of unacknowledged packets that the stream evicted from
its retransmit window because the window was full at on_send
time. Each eviction means the caller’s syscall succeeded
(bytes left this node) but the packet is no longer tracked
for retransmit — a NACK can no longer recover it. A non-zero
value indicates max_pending is undersized for the stream’s
sustained throughput. Operators should size up or apply
upstream backpressure rather than accepting silent loss.
Sourcepub fn next_expected(&self) -> u64
pub fn next_expected(&self) -> u64
Lowest sequence number we have not yet received. All sequences strictly below this value are contiguously received.
Sourcepub fn last_received_contiguous(&self) -> Option<u64>
pub fn last_received_contiguous(&self) -> Option<u64>
Highest contiguously-received sequence number, or None if no
packets have been received yet.
Sourcepub fn ack_seq(&self) -> u64
pub fn ack_seq(&self) -> u64
Get the current ack sequence (highest contiguously-received seq).
Returns 0 when nothing has been received yet — callers that need
to distinguish “received seq 0” from “received nothing” should use
Self::last_received_contiguous instead.
Trait Implementations§
Source§impl Debug for ReliableStream
impl Debug for ReliableStream
Source§impl Default for ReliableStream
impl Default for ReliableStream
Source§impl ReliabilityMode for ReliableStream
impl ReliabilityMode for ReliableStream
Source§fn on_send(&mut self, descriptor: Arc<RetransmitDescriptor>)
fn on_send(&mut self, descriptor: Arc<RetransmitDescriptor>)
Source§fn on_receive(&mut self, seq: u64) -> bool
fn on_receive(&mut self, seq: u64) -> bool
Source§fn build_nack(&self) -> Option<NackPayload>
fn build_nack(&self) -> Option<NackPayload>
Source§fn on_nack(&mut self, nack: &NackPayload) -> Vec<Arc<RetransmitDescriptor>>
fn on_nack(&mut self, nack: &NackPayload) -> Vec<Arc<RetransmitDescriptor>>
Arc clones
share the inner RetransmitDescriptor allocation; the
caller bumps the refcount instead of deep-cloning the
Vec<Bytes> of events.Source§fn get_timed_out(&mut self) -> Vec<Arc<RetransmitDescriptor>>
fn get_timed_out(&mut self) -> Vec<Arc<RetransmitDescriptor>>
Self::on_nack for the Arc-sharing contract.