Skip to main content

Module server

Module server 

Source
Available on crate feature std only.
Expand description

LL-HLS origin engine (issue #663/#717 Stage 2; plan step 4): the blocking-reload + part-availability decision logic and playlist rendering, driven directly from a shared media_plane::Trunk — not a push-fed rolling-window store of its own.

§Sans-IO shape

Nothing here ever .awaits or opens a socket. HlsOrigin implements media_plane::egress::ServedEgress: its resolve is a poll method returning media_plane::egress::EgressResponseReady, Await, BadRequest, or NotFound — never blocking the caller. The only asynchrony is media_plane::Trunk::listen, which hands back a runtime-agnostic event_listener::EventListener (a plain Future<Output = ()>) that any executor can await or time out — not a tokio::sync::watch.

§The caller-driven wait loop

An async adapter (e.g. multimux’s Step 5 LL-HLS route) turns an Await into an actual wait like this — the same shape MediaStore’s own (now-deleted) wait loop used, unchanged in spirit:

loop {
    let listener = trunk.listen(); // register BEFORE re-checking (no missed-wakeup race)
    match origin.resolve(request, now, await_policy) {
        EgressResponse::Ready { body, .. } => return Ready(body),
        EgressResponse::BadRequest { .. } => return BadRequest,
        EgressResponse::NotFound => return NotFound,
        EgressResponse::Await { .. } => {
            // caller's own bounded timeout wraps `listener.await` here
        }
    }
}

The blocking-reload cap is media_plane::egress::AwaitPolicy; the actual .await/tokio::time::timeout lives entirely in the adapter — this module never assumes a clock.

§std-only

Like media_plane::Trunk itself, this module needs std::sync::Mutex, so it is only compiled when this crate’s std feature is enabled (the default, and the only thing that pulls in the media-plane dependency at all — see this crate’s Cargo.toml). A caller building --no-default-features (e.g. an embedded playback-only client) gets crate::client but not server.

Structs§

BlockingQuery
Blocking playlist reload query parameters (RFC 8216bis §6.2.5.2) — the sans-IO counterpart of an adapter’s own (likely serde-Deserialize) query-string type; the adapter maps its wire query params into this.
HlsOrigin
The LL-HLS origin ServedEgress: renders playlists and resolves blocking-reload/part-availability requests for one stream, backed by a shared Trunk. See this module’s own doc for exactly what comes straight from the Trunk and what needs the small synced Window.
HlsOriginBuilder
Fluent builder for HlsOrigin (issue #873) — replaces the old four-positional HlsOrigin::new (deleted; this crate is at 0.4.0 unpublished, so there is no compatibility burden), which could not express “classic HLS, no low latency” at all since part_target_ms was a mandatory positional argument.

Enums§

Container
Which container HlsOrigin serves segments/parts as — orthogonal to whether LL-HLS is enabled (HlsOriginBuilder::low_latency); issue #873.
HlsBody
ServedEgress::Body for HlsOrigin: the resolved body, typed by which HlsRequest produced it. A data-carrying ADT — see tests/label_coverage.rs’s SKIP list.
HlsOriginBuildError
Error returned by HlsOriginBuilder::build when a required field was never set — never a silently-defaulted value (issue #873).
HlsRequest
ServedEgress::Request for HlsOrigin: which wire resource is being asked for. A data-carrying dispatch ADT (matches this crate’s client::action::Action/ResourceId convention) — see tests/label_coverage.rs’s SKIP list.

Constants§

DEFAULT_TRACK_ID
Track id for the single rendition served per stream (no multi-track/ multi-rendition support yet).

Functions§

master_playlist_m3u8
A minimal single-variant master playlist pointing at media_playlist_name (the caller’s configured media-playlist filename — e.g. multimux’s Config::playlist_name, defaulting to "media.m3u8") — the same regardless of any stream state (no multi-rendition support yet), so this takes no Trunk/origin argument.