pub struct StreamQos { /* private fields */ }Expand description
The consumer-selectable QoS vocabulary, wired from StreamOpt onto the file.
A stream’s carrier (moq / iroh) has non-fungible delivery semantics: a
reliable-in-order default plus richer modes that don’t reduce to it. Rather
than flatten those to a plain read, #819 exposes them as a small token
vocabulary written to qos / ctl. Each token toggles the StreamOpt
axes that already encode the behaviour (there is no new QoS model — this is
StreamOpt’s existing encoding, addressable through the file):
| token | StreamOpt effect |
|---|---|
reliable | the fail-closed default: ordered · at-least-once · end-of-stream · lossless backpressure |
latest-wins | drop-oldest overflow (depth 1) + live retention — only the newest payload matters |
lossy-ok | at-most-once + no terminator required + unordered (gaps tolerated) |
drop-stale | drop-oldest overflow + live retention — shed backlog instead of blocking |
Tokens compose (latest-wins drop-stale); reliable resets to the floor.
StreamQos::from_stream_opt / StreamQos::to_tokens round-trip the
selection against the underlying StreamOpt.
Implementations§
Source§impl StreamQos
impl StreamQos
Sourcepub fn reliable() -> Self
pub fn reliable() -> Self
The fail-closed reliable-in-order floor (matches StreamOpt’s @0
strictest defaults: ordered + end-of-stream, plus at-least-once /
live / block backpressure).
Sourcepub fn from_stream_opt(opt: StreamOpt) -> Self
pub fn from_stream_opt(opt: StreamOpt) -> Self
Wrap an existing StreamOpt (e.g. the producer-signed one from
StreamInfo) so it can be rendered as tokens / mutated by selection.
Sourcepub fn stream_opt(&self) -> &StreamOpt
pub fn stream_opt(&self) -> &StreamOpt
The underlying StreamOpt this selection resolves to.
Sourcepub fn is_lossy(&self) -> bool
pub fn is_lossy(&self) -> bool
Whether this QoS tolerates loss / gaps (at-most-once or unordered).
Under lossy QoS the mount surfaces a mid-stream carrier error as a soft end-of-stream (EOF) rather than a hard read error — the consumer-visible half of “lossy-ok”. Reliable QoS keeps failing closed.
Sourcepub fn apply_token(&mut self, token: &str) -> bool
pub fn apply_token(&mut self, token: &str) -> bool
Apply one vocabulary token, mutating the relevant StreamOpt axes.
Unknown tokens return false (the caller reports the error).
Trait Implementations§
impl StructuralPartialEq for StreamQos
Auto Trait Implementations§
impl Freeze for StreamQos
impl RefUnwindSafe for StreamQos
impl Send for StreamQos
impl Sync for StreamQos
impl Unpin for StreamQos
impl UnsafeUnpin for StreamQos
impl UnwindSafe for StreamQos
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
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>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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