#[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() -> Self
pub fn durable() -> Self
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() -> Self
pub fn durable_summary() -> Self
Self::DurableSummary with PatchKind::JsonMergePatch —
the only supported PatchKind in v0.6.
Sourcepub fn best_effort_live(ttl_ms: u32) -> Self
pub fn best_effort_live(ttl_ms: u32) -> Self
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) -> Self
pub fn best_effort_live_with_config(config: BestEffortLiveConfig) -> Self
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 more