Skip to main content

AppendLogSink

Trait AppendLogSink 

Source
pub trait AppendLogSink<T>: Send + Sync {
    // Required methods
    fn append_entries(
        &self,
        entries: &[T],
    ) -> Result<(), Box<dyn Error + Send + Sync>>;
    fn load_entries(&self) -> Result<Vec<T>, Box<dyn Error + Send + Sync>>;

    // Provided methods
    fn mode(&self) -> AppendLogMode { ... }
    fn flush(&self) -> Result<(), Box<dyn Error + Send + Sync>> { ... }
}
Expand description

Trait for append-log storage sinks used by ReactiveLog::attach_storage.

Implementors receive batches of entries and optionally support pre-loading. append_entries / load_entries / flush errors are swallowed by attach_storage’s in-wave delivery sink (matches TS try/catch semantics) so a failing tier doesn’t break the reactive graph. mode is consulted at attach time only.

Required Methods§

Source

fn append_entries( &self, entries: &[T], ) -> Result<(), Box<dyn Error + Send + Sync>>

Append entries to persistent storage.

Source

fn load_entries(&self) -> Result<Vec<T>, Box<dyn Error + Send + Sync>>

Load previously stored entries (for pre-loading on startup). Returns an empty vec if no entries are stored.

Provided Methods§

Source

fn mode(&self) -> AppendLogMode

D269 part-2 parity — sink’s persistence mode. attach_storage rejects Overwrite sinks at attach time. Default Append so existing impls work unchanged.

Source

fn flush(&self) -> Result<(), Box<dyn Error + Send + Sync>>

F9 parity (Option B per D171 precedent) — flush any buffered writes synchronously. Drives AttachStorageHandle::flush_all, which callers wire from a reactive timer subgraph (graphrefly_operators::temporal::interval). Default no-op so non-buffering sinks need no implementation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§