Skip to main content

RetentionClass

Enum RetentionClass 

Source
#[non_exhaustive]
pub enum RetentionClass { Timed, Sparse, }
Available on crate feature std only.
Expand description

Which retention discipline a published entry follows once inside the Trunk’s sample ring.

Named RetentionClass, not Retention — plan step 3e’s tiered hot/cold archive policy (docs/superpowers/plans/2026-07-26-media-plane-implementation.md) owns the name Retention for an unrelated, later concept. This is the orthogonal, in-ring question of “how eagerly can this entry be evicted”, decided per TrunkWriter::publish call by whoever is feeding the writer — it reflects a track’s nature (video/audio vs. an SCTE-35 section PID), not something intrinsic to a transmux::Sample itself, so it is not a field the spec’s Sample type carries.

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

Timed

Regular-cadence media samples (audio, video, …): count-bounded, and ordinary eviction is reported to a lagging SampleCursor as SampleCursorItem::Lagged — a consumer that misses a video frame is gapped, not wrong; it resumes from the next sample.

§

Sparse

Irregular, semantically-critical entries — an SCTE-35 splice cue, a subtitle sample — where losing one leaves a consumer’s derived state wrong, not merely gapped: a missed splice cue means splicing in the wrong place, or not at all.

§The retention rule

A Sparse entry lives in a ring bounded independently of the Timed ring (TrunkConfig::sparse_capacity, separate from TrunkConfig::timed_capacity). It is therefore never evicted “merely because a time window rolled” on the unrelated Timed class: no volume of video/audio publishes can push a still-live splice cue out of the trunk, because Timed publishes never touch the Sparse ring at all. A Sparse entry is only evicted once Sparse publish volume itself exceeds the Sparse ring’s own bound — and when that happens, SampleCursor::poll reports it as SampleCursorItem::Degraded, not ordinary Lagged: a distinct, stronger signal, because the consumer’s semantic state (e.g. “where the next ad break splices”) is now wrong. A consumer that sees Lagged should simply resume from the next sample; a consumer that sees Degraded should treat its derived state as unsynchronised until the next authoritative signal (a fresh cue, a manifest reload) re-establishes it — resuming silently would splice on stale information.

Trait Implementations§

Source§

impl Clone for RetentionClass

Source§

fn clone(&self) -> RetentionClass

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for RetentionClass

Source§

impl Debug for RetentionClass

Source§

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

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

impl Eq for RetentionClass

Source§

impl Hash for RetentionClass

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 RetentionClass

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RetentionClass

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.