Skip to main content

EventSink

Trait EventSink 

Source
pub trait EventSink: Send + Sync {
    // Required method
    fn record(&self, event: &Event);

    // Provided method
    fn flush(&self) { ... }
}
Expand description

A lossless, ordered consumer of events.

Unlike broadcast subscribers (which may lag and drop), sinks are invoked synchronously from EventBus::emit and must never lose an event. Implementations should buffer writes and must not panic; I/O errors are to be swallowed (optionally logged), never surfaced into the training loop.

Required Methods§

Source

fn record(&self, event: &Event)

Record one event. Called synchronously on the emitting thread.

Provided Methods§

Source

fn flush(&self)

Flush any buffered state to durable storage.

Implementors§