pub struct KernelEventLog { /* private fields */ }Expand description
Thread-safe ring buffer for kernel runtime events.
Captures boot events and any post-boot events (service starts/stops,
agent spawns, health checks, errors). Holds at most capacity events
— when full, the oldest event is evicted.
Used by the daemon to serve kernel.logs / kernel.logs_stream RPC
requests. Live subscribers receive entries as they are ingested
(WEFT-434); each entry carries a monotonic BootEvent::seq.
Implementations§
Source§impl KernelEventLog
impl KernelEventLog
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new event log with a specific capacity.
Sourcepub fn push(&self, event: BootEvent)
pub fn push(&self, event: BootEvent)
Push an event into the ring buffer and fan out to live subscribers.
Assigns a monotonic BootEvent::seq (starting at 1). The write
lock is released before subscriber notification so a slow
consumer cannot block ingest.
Sourcepub fn info(&self, source: &str, message: impl Into<String>)
pub fn info(&self, source: &str, message: impl Into<String>)
Push a simple info event with a source tag and message.
Sourcepub fn subscribe(&self) -> (u64, Receiver<BootEvent>)
pub fn subscribe(&self) -> (u64, Receiver<BootEvent>)
Subscribe to real-time log entries (WEFT-434).
Returns a subscription id (for Self::unsubscribe) and a
receiver that yields every event ingested after the subscribe
call. The channel is bounded; a slow consumer is dropped from
the fan-out set on the next failed try_send.
Sourcepub fn unsubscribe(&self, id: u64)
pub fn unsubscribe(&self, id: u64)
Drop a live subscriber. Idempotent.
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Number of active live subscribers.
Sourcepub fn info_with_chain(
&self,
source: &str,
message: impl Into<String>,
chain: Option<&ChainManager>,
)
pub fn info_with_chain( &self, source: &str, message: impl Into<String>, chain: Option<&ChainManager>, )
Push an info event and optionally append to the local chain.
Sourcepub fn ingest_boot_log(&self, boot_log: &BootLog)
pub fn ingest_boot_log(&self, boot_log: &BootLog)
Ingest all events from a BootLog (used to seed boot events).
Sourcepub fn tail(&self, n: usize) -> Vec<BootEvent>
pub fn tail(&self, n: usize) -> Vec<BootEvent>
Get the last n events (or all if n is 0 or exceeds count).
Trait Implementations§
Source§impl Debug for KernelEventLog
impl Debug for KernelEventLog
Auto Trait Implementations§
impl !Freeze for KernelEventLog
impl RefUnwindSafe for KernelEventLog
impl Send for KernelEventLog
impl Sync for KernelEventLog
impl Unpin for KernelEventLog
impl UnsafeUnpin for KernelEventLog
impl UnwindSafe for KernelEventLog
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 more