pub struct DistributedBus { /* private fields */ }Expand description
Clustered EventBus: a doorbell over the durable store (spec §3.2).
Implementations§
Source§impl DistributedBus
impl DistributedBus
Sourcepub async fn connect(url: &str, store: Arc<dyn Store>) -> Result<Self>
pub async fn connect(url: &str, store: Arc<dyn Store>) -> Result<Self>
Build a bus on its own pool. Each live subscription pins one connection
for its LISTEN, so the pool is sized above sqlx’s default of 10 to
allow a useful SSE fan-out before subscribe/publish start queuing on
the pool; raise it further (or share a pool) for high-fan-out deployments.
Trait Implementations§
Source§impl EventBus for DistributedBus
impl EventBus for DistributedBus
Source§fn publish(&self, event: FleetEvent)
fn publish(&self, event: FleetEvent)
Fan an event out to current subscribers. Never blocks on slow/absent
receivers (delivery is best-effort relative to the durable store).
Source§fn subscribe(&self, stream_key: &str) -> BusSubscription
fn subscribe(&self, stream_key: &str) -> BusSubscription
A live subscription to one stream’s events. The returned stream yields
only events whose stream key equals
stream_key; consumers dedup the
initial-history/live overlap on seq.Source§fn subscribe_all(&self) -> BusSubscription
fn subscribe_all(&self) -> BusSubscription
A live subscription to EVERY stream’s events, unfiltered. Needed by
fleet-wide watchers (e.g.
FleetManager::watch_changes) that can’t name
a stream key in advance — a brand-new agent’s own id keys its
AgentDiscovered event, so no one can pre-subscribe to it by key.Auto Trait Implementations§
impl Freeze for DistributedBus
impl !RefUnwindSafe for DistributedBus
impl Send for DistributedBus
impl Sync for DistributedBus
impl Unpin for DistributedBus
impl UnsafeUnpin for DistributedBus
impl !UnwindSafe for DistributedBus
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
Mutably borrows from an owned value. Read more
§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>
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 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>
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