#[non_exhaustive]pub enum StreamMode {
Durable,
DurableSummary {
patch_kind: PatchKind,
},
BestEffortLive {
config: BestEffortLiveConfig,
},
}Expand description
Per-call durability mode for [EngineBackend::append_frame].
RFC-015 §1. Mode is per-call — workers routinely mix frame types (tokens + progress + final summary) in a single attempt and the right durability differs per frame type. See RFC-015 §5 for the caveat on mixed-mode streams.
#[non_exhaustive]: new modes land additively (the v0.6 PR deliberately
excludes KeepAllDeltas, dropped by owner adjudication; a future
mode for e.g. per-frame-replicated streams would land here).
§Doc-comment contract on Self::Durable
If the same stream also receives Self::BestEffortLive frames,
Durable frames are subject to the best-effort MAXLEN trim (see
RFC-015 §5). Callers that need strict retention for Durable frames
alongside best-effort telemetry must not mix modes on one stream or
should place the durable frames on a sibling stream.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Durable
Current default — every frame XADDs as a durable entry.
DurableSummary
Server-side rolling-summary collapse. Each frame’s payload is a
delta/patch applied atomically to a summary Hash (per
PatchKind); the delta is also XADDed to the stream with
mode=summary fields so live tailers continue to observe change
events. RFC-015 §3.
BestEffortLive
Short-lived frame. XADDed with mode=best_effort; per-stream
MAXLEN rolls it off and the stream key gets a TTL refresh only
when the stream has never held a durable frame (RFC-015 §4.1).
The per-stream MAXLEN is computed dynamically in Lua from an
EMA of observed append rate (RFC-015 §4.2). See
BestEffortLiveConfig for the tunable knobs.
Fields
config: BestEffortLiveConfigImplementations§
Source§impl StreamMode
impl StreamMode
Sourcepub fn durable() -> StreamMode
pub fn durable() -> StreamMode
The v0.6 default — Self::Durable. Provided for symmetry with
the other constructors (the enum is #[non_exhaustive] so
cross-crate consumers cannot construct variants by name).
Sourcepub fn durable_summary() -> StreamMode
pub fn durable_summary() -> StreamMode
Self::DurableSummary with PatchKind::JsonMergePatch —
the only supported PatchKind in v0.6.
Sourcepub fn best_effort_live(ttl_ms: u32) -> StreamMode
pub fn best_effort_live(ttl_ms: u32) -> StreamMode
Self::BestEffortLive with the caller-supplied ttl_ms and
default BestEffortLiveConfig knobs.
RFC-015 §4 guidance: 5_000..=30_000 ms. Below ~1000 ms a live
tailer may not connect in time; above ~60_000 ms the memory
argument against plain Self::Durable weakens.
Sourcepub fn best_effort_live_with_config(config: BestEffortLiveConfig) -> StreamMode
pub fn best_effort_live_with_config(config: BestEffortLiveConfig) -> StreamMode
Self::BestEffortLive with a fully-specified
BestEffortLiveConfig. Use for per-workload tuning of α, the
MAXLEN clamp, or the TTL — defaults are wired from
BestEffortLiveConfig::with_ttl.
Trait Implementations§
Source§impl Clone for StreamMode
impl Clone for StreamMode
Source§fn clone(&self) -> StreamMode
fn clone(&self) -> StreamMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamMode
impl Debug for StreamMode
Source§impl Default for StreamMode
impl Default for StreamMode
Source§fn default() -> StreamMode
fn default() -> StreamMode
Source§impl Hash for StreamMode
impl Hash for StreamMode
Source§impl PartialEq for StreamMode
impl PartialEq for StreamMode
impl Copy for StreamMode
impl Eq for StreamMode
impl StructuralPartialEq for StreamMode
Auto Trait Implementations§
impl Freeze for StreamMode
impl RefUnwindSafe for StreamMode
impl Send for StreamMode
impl Sync for StreamMode
impl Unpin for StreamMode
impl UnsafeUnpin for StreamMode
impl UnwindSafe for StreamMode
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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