pub struct LogSinkCardSubscriber { /* private fields */ }Expand description
Fan-out CardEvents into per-session LogSink ring buffers.
Process-wide singleton accessed via log_sink_subscriber. Each Session
registers its own LogSink on start-up via register_log_sink and
unregisters on Drop of the returned LogSinkRegistration guard.
§Concurrency
Send + Sync. Internal state is Mutex<Vec<(u64, LogSink)>> +
AtomicU64. on_event uses the same snapshot-clone-then-iterate
pattern as CardEventBus::publish: sinks are cloned under the lock
then iterated with the lock released, so registrations/unregistrations
from other threads never deadlock a fan-out in flight. The mutex uses
the crate-wide unwrap_or_else(|p| p.into_inner()) policy so a
poisoned lock never propagates a panic.
Implementations§
Source§impl LogSinkCardSubscriber
impl LogSinkCardSubscriber
Sourcepub const URI: &'static str = "log-sink://alc.card"
pub const URI: &'static str = "log-sink://alc.card"
Fixed subscriber URI used by CardEventBus to key
SubscriberStats and to guard against duplicate registration.
Trait Implementations§
Source§impl CardSubscriber for LogSinkCardSubscriber
impl CardSubscriber for LogSinkCardSubscriber
Source§fn on_event(&self, ev: &CardEvent) -> Result<(), String>
fn on_event(&self, ev: &CardEvent) -> Result<(), String>
Always returns Ok(()).
Snapshots the sink list under sinks.lock(), releases the lock, then
pushes a LogEntry { source: "alc.card", level: "info", message: <fmt> }
into every snapshotted LogSink. Individual LogSink::push failures
(poisoned per-sink mutex) are silently dropped, matching the ring-buffer
best-effort policy in algocline_core::recent_log.
§Concurrency
Cancel-safe (no .await). Safe to call from any thread. Does not hold
self.sinks across the fan-out loop, so re-entrant registration from
within a LogSink::push implementation (currently impossible) would
still not deadlock.
Source§fn describe(&self) -> String
fn describe(&self) -> String
Returns the fixed subscriber URI "log-sink://alc.card".
Used by CardEventBus to key SubscriberStats and by
log_sink_subscriber initializer to guard against duplicate
registration on the bus.
Auto Trait Implementations§
impl !Freeze for LogSinkCardSubscriber
impl RefUnwindSafe for LogSinkCardSubscriber
impl Send for LogSinkCardSubscriber
impl Sync for LogSinkCardSubscriber
impl Unpin for LogSinkCardSubscriber
impl UnsafeUnpin for LogSinkCardSubscriber
impl UnwindSafe for LogSinkCardSubscriber
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 moreimpl<T> MaybeSend for Twhere
T: Send,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.