pub struct MoqStreamPublisher { /* private fields */ }Expand description
In-process moq publisher with the §7.5 chained-HMAC tokenstream.
API mirrors [crate::streaming::StreamPublisher] (publish_data,
publish_error, complete, …) but appends to a moq Track instead of a
ZMQ PUSH socket. Each call produces one StreamBlock = one moq Group whose
single Frame payload is capnp_bytes || mac[16].
NOTE (M2a vs M2b): the StreamBlock encoding + HMAC chain are byte-identical
to the ZMQ path (shared encode_stream_block), but the batching policy
differs — this emits one payload per block/Group, whereas the ZMQ
StreamBuilder adaptively batches multiple payloads per block. The MAC
chain is valid either way (the verifier is batch-agnostic). Port
BatchingConfig in M2b for granularity parity.
Implementations§
Source§impl MoqStreamPublisher
impl MoqStreamPublisher
Sourcepub async fn wait_for_consumer(&self) -> Result<()>
pub async fn wait_for_consumer(&self) -> Result<()>
Wait until a subscriber has attached before publishing a short lived response. The demand is observable on the producer track, so callers can avoid finishing before a late subscriber has a chance to join.
Sourcepub fn publish_next_epoch(&mut self) -> Result<u64>
pub fn publish_next_epoch(&mut self) -> Result<u64>
Publish an opaque, authenticated control Object under the current epoch,
then atomically advance the producer to the next epoch. The consumer
performs the same verify-before-advance transition from the wire Object.
next_group deliberately never resets, preserving immutable MOQT IDs.
Sourcepub async fn publish_data(&mut self, data: &[u8]) -> Result<()>
pub async fn publish_data(&mut self, data: &[u8]) -> Result<()>
Publish one binary payload as a StreamBlock group.
Sourcepub async fn publish_error(&mut self, message: &str) -> Result<()>
pub async fn publish_error(&mut self, message: &str) -> Result<()>
Publish an error payload (terminal).
Sourcepub async fn complete(self, metadata: &[u8]) -> Result<()>
pub async fn complete(self, metadata: &[u8]) -> Result<()>
Complete the stream with metadata (terminal).
Sourcepub async fn complete_ref(&mut self, metadata: &[u8]) -> Result<()>
pub async fn complete_ref(&mut self, metadata: &[u8]) -> Result<()>
Complete the stream without consuming self.
Sourcepub fn is_terminated(&self) -> bool
pub fn is_terminated(&self) -> bool
Whether a terminal frame (Error/Complete) was sent.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the stream has been cancelled.
Source§impl MoqStreamPublisher
impl MoqStreamPublisher
Sourcepub async fn publish_data_with_rate(
&mut self,
data: &[u8],
rate: f32,
) -> Result<()>
pub async fn publish_data_with_rate( &mut self, data: &[u8], rate: f32, ) -> Result<()>
Publish binary data with a rate hint (ignored — each call maps 1:1 to one moq Group).
Sourcepub async fn publish_progress(
&mut self,
stage: &str,
current: usize,
total: usize,
) -> Result<()>
pub async fn publish_progress( &mut self, stage: &str, current: usize, total: usize, ) -> Result<()>
Publish a progress update (stage:current:total).
Auto Trait Implementations§
impl Freeze for MoqStreamPublisher
impl !RefUnwindSafe for MoqStreamPublisher
impl Send for MoqStreamPublisher
impl Sync for MoqStreamPublisher
impl Unpin for MoqStreamPublisher
impl UnsafeUnpin for MoqStreamPublisher
impl !UnwindSafe for MoqStreamPublisher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more