Skip to main content

EventPublisher

Struct EventPublisher 

Source
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

Source

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).

Source

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).

Source

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).

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn wrap_for_new_subscribers( &self, _prefix: &str, _subscriber_pubkeys: &[[u8; 32]], ) -> Result<Vec<([u8; 32], Vec<u8>)>, String>

Source

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.

Source

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()).

Source

pub async fn needs_rotation(&self, prefix: &str) -> bool

True if a key rotation is due for prefix per this publisher’s RekeyPolicy.

Source

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.

Source

pub fn privacy_mode(&self) -> EventPrivacy

The privacy mode this publisher was constructed with.

Source

pub fn verifying_key(&self) -> Option<[u8; 32]>

The Ed25519 verifying key bytes, if this is an encrypted publisher.

Source

pub fn source(&self) -> &str

The bound primary source (single-prefix publishers only; empty for multi-prefix new_encrypted publishers).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> MaybeSync for T
where T: Sync,