Struct SubscriptionHub
pub struct SubscriptionHub { /* private fields */ }Expand description
The process’s subscription sources. Cheap to share behind an Arc.
Implementations§
Source§impl SubscriptionHub
impl SubscriptionHub
Sourcepub fn with_limits(ring: RingLimits, byte_budget: usize) -> Self
pub fn with_limits(ring: RingLimits, byte_budget: usize) -> Self
A hub with explicit caps (tests use small ones).
Sourcepub fn publish(&self, source: Source, frame: Value) -> u64
pub fn publish(&self, source: Source, frame: Value) -> u64
Append a frame and wake that source’s subscribers. Never waits. Returns the frame’s sequence number.
Sourcepub fn note_loss(&self, source: Source, count: u64)
pub fn note_loss(&self, source: Source, count: u64)
Record that count frames for source were lost before reaching the
hub. Their sequence numbers are skipped, so any cursor that would have
read them reads Read::Lagged instead.
Sourcepub fn epoch(&self) -> &str
pub fn epoch(&self) -> &str
This hub’s identity. Sequence numbers are only comparable within one epoch.
Sourcepub fn oldest_seq(&self, source: Source) -> u64
pub fn oldest_seq(&self, source: Source) -> u64
The sequence number of the oldest frame still buffered, or the next sequence number when the ring is empty.
Sourcepub fn head_seq(&self, source: Source) -> u64
pub fn head_seq(&self, source: Source) -> u64
The sequence number of the newest frame (0 before the first).
Sourcepub fn read(&self, source: Source, cursor: u64, max: usize) -> Read
pub fn read(&self, source: Source, cursor: u64, max: usize) -> Read
Up to max frames at or after cursor, or the gap the cursor is in.
Sourcepub fn notifier(&self, source: Source) -> &Notify
pub fn notifier(&self, source: Source) -> &Notify
The wakeup for source, signalled on every publish and loss.
Sourcepub fn total_bytes(&self) -> usize
pub fn total_bytes(&self) -> usize
Total bytes held across all rings.
Sourcepub fn attach_bus(self: &Arc<Self>, tx: &Sender<Value>)
pub fn attach_bus(self: &Arc<Self>, tx: &Sender<Value>)
Feed this hub from the daemon event bus: every frame into
Source::Logs, observer frames into Source::Events. Idempotent:
only the first call starts the pump.
Pairing credentials are dropped before they reach a ring, so they are
never replayed, and the internal marker is stripped from everything
else. A broadcast overrun is recorded with Self::note_loss, so
subscribers see lagged, not a silent gap.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SubscriptionHub
impl !RefUnwindSafe for SubscriptionHub
impl Send for SubscriptionHub
impl Sync for SubscriptionHub
impl Unpin for SubscriptionHub
impl UnsafeUnpin for SubscriptionHub
impl UnwindSafe for SubscriptionHub
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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