pub struct EngineBuilder { /* private fields */ }Expand description
Fluent builder for an Engine. Takes plain owned specs instead of a
deserialized config schema, so consumers never adopt stream-center’s TOML.
use arcly_stream::prelude::*;
let engine = Engine::builder()
.max_publishers(1_000)
.application(AppSpec::new("live").broadcast_capacity(8192))
.build();
assert_eq!(engine.list_apps().len(), 1);Implementations§
Source§impl EngineBuilder
impl EngineBuilder
Sourcepub fn max_publishers(self, n: usize) -> Self
pub fn max_publishers(self, n: usize) -> Self
Set the hard cap on concurrent publishing streams.
Sourcepub fn config(self, config: EngineConfig) -> Self
pub fn config(self, config: EngineConfig) -> Self
Replace the whole engine config.
Sourcepub fn application(self, app: AppSpec) -> Self
pub fn application(self, app: AppSpec) -> Self
Register an application.
Sourcepub fn applications(self, apps: impl IntoIterator<Item = AppSpec>) -> Self
pub fn applications(self, apps: impl IntoIterator<Item = AppSpec>) -> Self
Register many applications at once.
Sourcepub fn observer<O: Observer>(self, observer: O) -> Self
pub fn observer<O: Observer>(self, observer: O) -> Self
Install a telemetry observer. Defaults to NoopObserver if unset.
Sourcepub fn observer_arc(self, observer: Arc<dyn Observer>) -> Self
pub fn observer_arc(self, observer: Arc<dyn Observer>) -> Self
Install a pre-shared observer (when the host already holds an Arc).
Sourcepub fn authenticator<A: StreamAuthenticator>(self, auth: A) -> Self
pub fn authenticator<A: StreamAuthenticator>(self, auth: A) -> Self
Install a stream authenticator. Defaults to AllowAll if unset.
Sourcepub fn authenticator_arc(self, auth: Arc<dyn StreamAuthenticator>) -> Self
pub fn authenticator_arc(self, auth: Arc<dyn StreamAuthenticator>) -> Self
Install a pre-shared authenticator (when the host already holds an Arc).
Sourcepub fn idle_timeout(self, timeout: Duration) -> Self
pub fn idle_timeout(self, timeout: Duration) -> Self
Set the idle timeout after which frame-less streams are reaped.
Sourcepub fn protocol<P: InboundProtocol>(self, protocol: P) -> Self
pub fn protocol<P: InboundProtocol>(self, protocol: P) -> Self
Register an inbound protocol worker (RTMP, or any custom
InboundProtocol from your own crate). Workers registered here are run
by Engine::serve_registered.
let engine = Engine::builder()
.application(AppSpec::new("live").gop_cache(120))
.protocol(RtmpHandler::new("0.0.0.0:1935".parse().unwrap()))
// .protocol(MyCustomProtocol::new()) // your own InboundProtocol
.build();
engine.serve_registered(CancellationToken::new()).awaitSourcepub fn protocol_boxed(self, protocol: Box<dyn InboundProtocol>) -> Self
pub fn protocol_boxed(self, protocol: Box<dyn InboundProtocol>) -> Self
Register a pre-boxed protocol worker (when the host already holds a
Box<dyn InboundProtocol>, e.g. built dynamically from config).