pub struct MoqEventPublisher { /* private fields */ }Expand description
In-process moq event publisher.
Publishes topic+payload pairs to the local/events/{source} broadcast.
Each publish_raw call writes one moq Group (one Frame) on the events track.
When constructed via MoqEventOrigin::publisher_with_oid, each event is
ALSO mirrored to the per-OID (#393) publication track so selective
subscribers receive it without the firehose. When constructed via
MoqEventOrigin::publisher_oid_only, track IS the OID track and
oid_track is None.
Implementations§
Source§impl MoqEventPublisher
impl MoqEventPublisher
Sourcepub fn publish_raw(&mut self, topic: &str, payload: &[u8]) -> Result<()>
pub fn publish_raw(&mut self, topic: &str, payload: &[u8]) -> Result<()>
Publish a raw topic + payload.
Frame format: [4 bytes topic_len BE][topic bytes][payload bytes].
If this publisher was created with an OID mirror, the frame is written to both the flat source track and the per-OID publication track (one Group on each, sharing the same group id so consumers on either track see a consistent sequence).
Sourcepub fn publish(
&mut self,
entity: &str,
event: &str,
payload: &[u8],
) -> Result<()>
pub fn publish( &mut self, entity: &str, event: &str, payload: &[u8], ) -> Result<()>
Publish {source}.{entity}.{event} with payload.
Sourcepub fn has_oid_mirror(&self) -> bool
pub fn has_oid_mirror(&self) -> bool
True if this publisher mirrors events to a per-OID (#393) publication track.
Auto Trait Implementations§
impl Freeze for MoqEventPublisher
impl RefUnwindSafe for MoqEventPublisher
impl Send for MoqEventPublisher
impl Sync for MoqEventPublisher
impl Unpin for MoqEventPublisher
impl UnsafeUnpin for MoqEventPublisher
impl UnwindSafe for MoqEventPublisher
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