Skip to main content

BusCaptureAdapter

Struct BusCaptureAdapter 

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

Captures bus traffic and forwards encoded entries to the EventStoreWriter.

One adapter instance owns one writer; the kernel constructs the adapter after spawning the writer, then registers it with the bus dispatch wrappers. The adapter is Send + Sync so it can be shared between bus subscribers, but in practice the message bus is single-threaded and the adapter lives on the engine thread.

Implementations§

Source§

impl BusCaptureAdapter

Source

pub fn new( writer: Arc<EventStoreWriter>, registry: Arc<EncoderRegistry>, halt: HaltCallback, ) -> Self

Constructs a new adapter over writer, registry, and halt.

halt is the adapter-level fail-stop callback. The writer carries its own halt callback for backend and backpressure failures; the adapter callback fires on any submit error so SubmitError::Closed (which can originate outside the writer’s own halt path, e.g. an external close) still reaches the kernel.

Source

pub fn with_submit_counter(self, submit_counter: Arc<AtomicU64>) -> Self

Shares an entry-submit counter with the data-marker capture path.

Source

pub fn is_halted(&self) -> bool

Returns whether the adapter has fail-stopped.

Source

pub fn registry(&self) -> &EncoderRegistry

Returns the encoder allow-list this adapter consults.

Source

pub fn high_watermark(&self) -> u64

Returns the wrapped writer’s current durable high-watermark.

Source

pub fn capture<T: 'static>( &self, topic: Topic, message: &T, headers: Headers, ts_init: UnixNanos, ) -> Result<bool, CaptureError>

Captures a state-affecting bus message.

Looks up the encoder for T, builds an EntryDraft, and forwards it to the writer. Returns Ok(false) when the type has no registered encoder so the adapter can be wired into bus dispatch paths that carry a mix of state-affecting and non-state-affecting messages without surfacing per-message errors, and when the message’s registered identity was already captured on another dispatch hop (the same order event reaches the tap via the portfolio endpoint send and the strategy topic publish; the log records it once).

topic is the bus topic the message was dispatched on, headers are the dispatch-time correlation headers (defaulting to Headers::empty until header propagation lands across all message types), and ts_init is the domain timestamp from AtomicTime (typically the message’s own ts_init field).

§Errors

Returns:

Source

pub fn capture_any( &self, topic: Topic, message: &dyn Any, headers: Headers, ts_init: UnixNanos, ) -> Result<bool, CaptureError>

Type-erased counterpart to Self::capture.

Bus dispatch hands messages to the tap as &dyn Any because the static type is not in scope at the registration site. This method dispatches on the concrete type behind the trait object and follows the same fail-stop semantics as Self::capture.

§Errors

See Self::capture.

Trait Implementations§

Source§

impl Debug for BusCaptureAdapter

Source§

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

Formats the value using the given formatter. Read more

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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: Sized + 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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = 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<T> Ungil for T
where T: Send,

§

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