pub struct IngestContext { /* private fields */ }Expand description
The ergonomic, cloneable handle a protocol worker uses to reach the engine
bus, handed to every InboundProtocol::serve call.
It hides the PublishRegistry trait object behind a small, stable surface:
claim a stream for publishing (open_publish), or reach
the underlying registry for advanced flows (registry).
Cloning is cheap (an Arc bump) — share it freely across per-connection tasks.
Implementations§
Source§impl IngestContext
impl IngestContext
Sourcepub fn new(registry: Arc<dyn PublishRegistry>) -> Self
pub fn new(registry: Arc<dyn PublishRegistry>) -> Self
Wrap a publish registry. The engine constructs this for you; tests and
embedders can build one directly from any PublishRegistry (e.g. an
Arc<Engine>).
Sourcepub async fn open_publish(&self, key: StreamKey) -> Result<PublishSession>
pub async fn open_publish(&self, key: StreamKey) -> Result<PublishSession>
Claim key for publishing, returning an RAII PublishSession.
Frames published through the returned session flow into the lock-free
broadcast fan-out, the keyframe-anchored GOP cache (for instant-start
replay), and the live QoS counters — exactly as a native handler’s frames
do. Fails with StreamAlreadyPublishing on a live duplicate or
PublisherLimitReached at capacity.
Sourcepub async fn open_publish_checked(
&self,
key: StreamKey,
creds: &Credentials,
) -> Result<PublishSession>
pub async fn open_publish_checked( &self, key: StreamKey, creds: &Credentials, ) -> Result<PublishSession>
Like open_publish, but enforces the registry’s
admission policy (PublishRegistry::start_publish_checked) against
creds first — protocol handlers that carry a credential (SRT passphrase/
streamid token, a publish token) should use this so the publish is gated
before any media is accepted.
Sourcepub fn registry(&self) -> &Arc<dyn PublishRegistry> ⓘ
pub fn registry(&self) -> &Arc<dyn PublishRegistry> ⓘ
The underlying publish registry, for flows not covered by
open_publish.
Trait Implementations§
Source§impl Clone for IngestContext
impl Clone for IngestContext
Source§fn clone(&self) -> IngestContext
fn clone(&self) -> IngestContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more