pub struct EventPublisher { /* private fields */ }Expand description
The canonical broadcast event publisher (EV1, epic #600).
One instance manages publishing to one or more local/events/{prefix}
broadcasts. Each registered prefix gets its own moq transport and — for
encrypted privacy modes — its own group key and Ristretto255 ephemeral
keypair.
Implementations§
Source§impl EventPublisher
impl EventPublisher
Sourcepub fn new(source: &str) -> Result<Self>
pub fn new(source: &str) -> Result<Self>
Create a plaintext (EventPrivacy::Public) publisher for source.
Wire-identical to the pre-EV1 plaintext publisher: requires the
process-global moq event bus to have been initialized via
init_global_moq_event_origin (done by the event-service factory at
startup).
Sourcepub fn new_with_oid(source: &str, oid: &str) -> Result<Self>
pub fn new_with_oid(source: &str, oid: &str) -> Result<Self>
Plaintext publisher for source that ALSO mirrors every event to the
per-OID (#393) publication track for oid (transition path).
Sourcepub fn new_oid_only(source: &str, oid: &str) -> Result<Self>
pub fn new_oid_only(source: &str, oid: &str) -> Result<Self>
Plaintext publisher that writes ONLY to the per-OID (#393) publication
track for oid (no flat-track mirror; post-migration).
Sourcepub fn new_encrypted(
signing_key: SigningKey,
privacy_mode: EventPrivacy,
rekey_policy: RekeyPolicy,
) -> Result<Self, String>
pub fn new_encrypted( signing_key: SigningKey, privacy_mode: EventPrivacy, rekey_policy: RekeyPolicy, ) -> Result<Self, String>
Create an encrypted (ZeroKnowledge/LimitedKnowledge) publisher.
No prefix is bound at construction — call Self::register_prefix
for each local/events/{prefix} broadcast this publisher will write
to, then Self::publish_raw with a fully-qualified
{prefix}.{entity}.{event} topic (the convenience
publish(entity, event, payload) method is only available on
single-prefix Public-mode publishers from new/new_with_oid/
new_oid_only).
Sourcepub fn with_authz(self, authz: Arc<dyn EventAuthz>) -> Self
pub fn with_authz(self, authz: Arc<dyn EventAuthz>) -> Self
Inject the event-plane authz (EV4). The encrypted profile defaults to
DenyAllEventAuthz (fail-closed); production wires a UCAN/capability-
backed impl (S3/S4 vocab) here. Returns self for chaining.
Sourcepub fn with_publisher_identity(self, identity: PublisherIdentity) -> Self
pub fn with_publisher_identity(self, identity: PublisherIdentity) -> Self
Inject the publisher’s verified identity (EV4 authn-on-publish). Until #446 lands the default is anonymous, which fail-closes confidential publish; a non-IPC path (or post-#446) supplies a verified DID here.
Sourcepub async fn register_prefix(
&self,
tenant: &str,
prefix: &str,
) -> Result<(), String>
pub async fn register_prefix( &self, tenant: &str, prefix: &str, ) -> Result<(), String>
Register a confidential MOQT prefix. No key is generated here: publish remains fail-closed until the controller installs a committed epoch.
Sourcepub async fn install_committed_epoch(
&self,
prefix: &str,
membership_version: u64,
epoch: u64,
epoch_secret: Zeroizing<[u8; 32]>,
) -> Result<(), String>
pub async fn install_committed_epoch( &self, prefix: &str, membership_version: u64, epoch: u64, epoch_secret: Zeroizing<[u8; 32]>, ) -> Result<(), String>
Install an epoch only after the controller atomically committed the same membership-version/epoch coordinates.
Sourcepub async fn wrap_for_subscriber(
&self,
_prefix: &str,
_subscriber_pubkey: &[u8; 32],
) -> Result<Vec<u8>, String>
pub async fn wrap_for_subscriber( &self, _prefix: &str, _subscriber_pubkey: &[u8; 32], ) -> Result<Vec<u8>, String>
Classical Ristretto wrapping was removed. Epoch release is exclusively
per-member HyKEM/COSE via GroupKeyRegistry::prepare_change.
pub async fn wrap_for_new_subscribers( &self, _prefix: &str, _subscriber_pubkeys: &[[u8; 32]], ) -> Result<Vec<([u8; 32], Vec<u8>)>, String>
Sourcepub async fn publish(
&self,
entity: &str,
event: &str,
payload: &[u8],
) -> Result<()>
pub async fn publish( &self, entity: &str, event: &str, payload: &[u8], ) -> Result<()>
Publish {primary_source}.{entity}.{event} (matches the pre-EV1
plaintext EventPublisher::publish(entity, event, payload) call
shape). Only valid on single-prefix publishers from new/
new_with_oid/new_oid_only; multi-prefix new_encrypted publishers
must use Self::publish_raw with a fully-qualified topic.
Sourcepub async fn publish_raw(&self, topic: &str, payload: &[u8]) -> Result<()>
pub async fn publish_raw(&self, topic: &str, payload: &[u8]) -> Result<()>
Publish a pre-formatted {prefix}.{...} topic + payload.
In Public mode the payload is written unmodified (byte-identical to
the pre-EV1 plaintext path). In ZeroKnowledge/LimitedKnowledge
mode the payload is signed + encrypted and wrapped in a wire frame
(see module docs) before being written to the shared moq track for
the topic’s prefix (topic.split('.').next()).
Sourcepub async fn needs_rotation(&self, prefix: &str) -> bool
pub async fn needs_rotation(&self, prefix: &str) -> bool
True if a key rotation is due for prefix per this publisher’s
RekeyPolicy.
Sourcepub async fn rotate_key(
&self,
_prefix: &str,
_effective_delay: Duration,
) -> Result<RotationResult, String>
pub async fn rotate_key( &self, _prefix: &str, _effective_delay: Duration, ) -> Result<RotationResult, String>
EventService cannot rotate or distribute epochs by itself. The
controller must prepare+commit through GroupKeyRegistry, deliver each
HyKEM grant out of band, then call Self::install_committed_epoch.
Sourcepub fn privacy_mode(&self) -> EventPrivacy
pub fn privacy_mode(&self) -> EventPrivacy
The privacy mode this publisher was constructed with.
Sourcepub fn verifying_key(&self) -> Option<[u8; 32]>
pub fn verifying_key(&self) -> Option<[u8; 32]>
The Ed25519 verifying key bytes, if this is an encrypted publisher.
Auto Trait Implementations§
impl Freeze for EventPublisher
impl !RefUnwindSafe for EventPublisher
impl Send for EventPublisher
impl Sync for EventPublisher
impl Unpin for EventPublisher
impl UnsafeUnpin for EventPublisher
impl !UnwindSafe for EventPublisher
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