Skip to main content

StreamMode

Enum StreamMode 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§patch_kind: PatchKind
§

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.

Implementations§

Source§

impl StreamMode

Source

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).

Source

pub fn durable_summary() -> Self

Self::DurableSummary with PatchKind::JsonMergePatch — the only supported PatchKind in v0.6.

Source

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.

Source

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.

Source

pub fn wire_str(&self) -> &'static str

Stable wire-level token for this mode, written to the XADD entry mode field (RFC-015 §6.1). Tail filters compare against these string values server-side.

Trait Implementations§

Source§

impl Clone for StreamMode

Source§

fn clone(&self) -> StreamMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StreamMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StreamMode

Source§

fn default() -> StreamMode

Returns the “default value” for a type. Read more
Source§

impl Hash for StreamMode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for StreamMode

Source§

fn eq(&self, other: &StreamMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for StreamMode

Source§

impl Eq for StreamMode

Source§

impl StructuralPartialEq for StreamMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.