Skip to main content

InProcessBroker

Struct InProcessBroker 

Source
pub struct InProcessBroker { /* private fields */ }
Expand description

Synchronous, in-memory implementation of EventBroker.

The broker stores a bounded retention buffer per event type and maintains a bounded delivery queue per subscription. Subscribers poll for events using a broker-issued subscription id and a cursor.

Implementations§

Source§

impl InProcessBroker

Source

pub fn new(catalog: Arc<EventCatalog>) -> Result<Self, EventError>

Create a new broker backed by the given catalog.

§Errors

Returns EventError::InvalidRetentionWindow when the provided configuration is invalid.

Source

pub fn with_clock( catalog: Arc<EventCatalog>, config: BrokerConfig, clock: Arc<dyn BrokerClock>, ) -> Result<Self, EventError>

Create a broker with explicit configuration and clock.

§Errors

Returns EventError::InvalidRetentionWindow when the provided configuration is invalid.

Source

pub fn with_clock_and_validation( catalog: Arc<EventCatalog>, config: BrokerConfig, clock: Arc<dyn BrokerClock>, validation_mode: EventValidationMode, ) -> Result<Self, EventError>

Create a broker with an explicit governed-event enforcement policy.

Migration mode records violations without interrupting existing traffic; enforcement mode rejects invalid envelopes.

§Errors

Returns EventError::InvalidRetentionWindow when the configuration cannot maintain replay and queue guarantees.

Source

pub fn validation_evidence(&self) -> Vec<EventValidationEvidence>

Returns sanitized validation and quarantine evidence. Payload data is never retained through this interface.

Source

pub fn quarantine_records(&self) -> Vec<EventQuarantineRecord>

Returns sanitized enforcement rejections prepared for governed quarantine.

Source

pub fn observed_lineage(&self) -> Vec<EventLineageRecord>

Returns sanitized runtime delivery observations for catalog reconciliation.

Source

pub fn telemetry(&self) -> Vec<EventTelemetryRecord>

Returns deterministic, sanitized boundary telemetry for host export.

Source

pub fn metrics(&self) -> EventRuntimeMetrics

Returns a deterministic counter snapshot for event runtime evidence.

Source

pub fn subscribe_for_consumer( &self, event_type: &str, from_cursor: &str, consumer_id: &str, subject_id: Option<&str>, ) -> Result<Subscription, EventError>

Subscribe with the consuming capability identity needed for observed lineage.

The identity is runtime evidence only; it does not declare a catalog relationship.

§Errors

Returns EventError::LifecycleViolation when consumer_id is empty, plus the same errors as EventBroker::subscribe_for_subject.

Trait Implementations§

Source§

impl Debug for InProcessBroker

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl EventBroker for InProcessBroker

Source§

fn publish(&self, event: TraverseEvent) -> Result<(), EventError>

Publish event to all registered subscribers.

§Errors
Source§

fn publish_with_cursor( &self, event: TraverseEvent, cursor: &str, ) -> Result<(), EventError>

Publish event, adopting cursor as this broker’s own cursor for it instead of self-assigning the next per-type sequence value. Used by DurableBroker so live-delivery cursors stay numerically consistent with the durable journal’s cursor space (spec 066 FR-007): a cursor obtained during live polling remains valid when a later poll falls back to durable replay.

§Errors

Returns EventError::InvalidCursor when cursor is not a base-10 unsigned integer, plus the same errors as Self::publish.

Source§

fn subscribe( &self, event_type: &str, from_cursor: &str, ) -> Result<Subscription, EventError>

Create a subscription for event_type starting from from_cursor.

The event type must already be registered in the catalog.

§Errors

Returns EventError::UnregisteredEventType if the event type is not catalogued.

Source§

fn poll( &self, subscription_id: &str, max_events: usize, ) -> Result<SubscriptionPoll, EventError>

Poll a subscription for up to max_events.

§Errors
Source§

fn cancel(&self, subscription_id: &str) -> Result<(), EventError>

Cancel a subscription.

§Errors

Returns EventError::SubscriptionNotFound if the subscription id is unknown.

Source§

fn subscribe_for_subject( &self, event_type: &str, from_cursor: &str, subject_id: Option<&str>, ) -> Result<Subscription, EventError>

Create a subscription optionally limited to one event subject. Read more
Source§

fn seed_restart_floor(&self, floor: u64)

Establishes a floor below which any cursor, for any event type this broker has not itself observed, is treated as potentially predating this broker instance’s own history (spec 066 FR-007: restart cursor continuity). DurableBroker::open calls this once at construction, seeded from the durable journal’s latest cursor, so a freshly constructed in-memory broker correctly defers stale-looking cursors to durable replay after a restart instead of accepting them outright. The default implementation is a no-op.

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.

Source§

impl<T> GetSetFdFlags for T

Source§

fn get_fd_flags(&self) -> Result<FdFlags, Error>
where T: AsFilelike,

Query the “status” flags for the self file descriptor.
Source§

fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>
where T: AsFilelike,

Create a new SetFdFlags value for use with set_fd_flags. Read more
Source§

fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>
where T: Sized + AsFilelike,

Set the “status” flags for the self file descriptor. Read more
Source§

impl<T> Instrument for T

Source§

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

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

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Pointee for T

Source§

type Pointer = u32

Source§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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