pub trait ClusterRelay:
Send
+ Sync
+ 'static {
// Required methods
fn locate<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
) -> Pin<Box<dyn Future<Output = Result<Option<NodeAddr>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn pull<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
origin: &'life2 NodeAddr,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn announce<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn withdraw<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn ensure_mirrored<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Required Methods§
Sourcefn locate<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
) -> Pin<Box<dyn Future<Output = Result<Option<NodeAddr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn locate<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
) -> Pin<Box<dyn Future<Output = Result<Option<NodeAddr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find a node currently serving key, if any (e.g. via the control plane).
Sourcefn pull<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
origin: &'life2 NodeAddr,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn pull<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
origin: &'life2 NodeAddr,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Begin relaying key from origin into the local engine, returning once
the local mirror is publishing.
Provided Methods§
Sourcefn ensure_mirrored<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ensure_mirrored<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 StreamKey,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Demand policy on top of the locate/pull
mechanism: make key available locally, returning true if a mirror is
now (or already) present and false if no origin serves it.
A host serving a play/WHEP/HLS request calls this so it doesn’t have to
hand-write “locate, then pull if not already local.” Implementations
should de-duplicate concurrent callers for the same key (single-flight)
so a burst of N simultaneous viewer requests for a not-yet-mirrored stream
triggers one pull, not N racing start_publish calls.
The default is a plain locate + pull with no coalescing or
locality check; NetworkRelay
overrides it with a locality fast-path and single-flight.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl ClusterRelay for InProcessRelay
cluster only.