Skip to main content

KernelEventStore

Trait KernelEventStore 

Source
pub trait KernelEventStore: Debug {
    // Required methods
    fn restore_parent_cache(
        &mut self,
        instance_id: UUID4,
        cache: &mut Cache,
    ) -> Result<()>;
    fn open(
        &mut self,
        instance_id: UUID4,
        components: &RegisteredComponents,
        environment: Environment,
    ) -> Result<()>;
    fn snapshot_anchorer(&self) -> Option<SnapshotAnchorer>;
    fn seal(&mut self, ts_init: UnixNanos);
    fn run_id(&self) -> Option<&str>;
    fn parent_run_id(&self) -> Option<&str>;
    fn is_halted(&self) -> bool;

    // Provided method
    fn is_event_store_replay_configured(&self) -> bool { ... }
}
Expand description

Kernel-facing seam for event-sourcing lifecycle integration.

NautilusKernel drives the open/restore/seal sequence through this trait so the concrete event-store machinery (writers, readers, bus tap, redb backend) lives outside nautilus-system. Implementations are typically built by the caller and injected via crate::builder::NautilusKernelBuilder::with_event_store.

Required Methods§

Source

fn restore_parent_cache( &mut self, instance_id: UUID4, cache: &mut Cache, ) -> Result<()>

Restores cache state from a configured replay source or recovered parent run.

Implementations may open a sealed replay source, validate its snapshot anchor, and replay the tail directly into cache. The kernel calls this once before Self::open.

§Errors

Returns an error when the source reader, snapshot restore, decode, or cache apply step fails.

Source

fn open( &mut self, instance_id: UUID4, components: &RegisteredComponents, environment: Environment, ) -> Result<()>

Opens a fresh run for the current kernel session.

components carries the registered manifest written to the run’s RunStarted entry. environment selects the clock source the implementation uses to stamp publish timestamps. Idempotency across reset/rerun is the implementation’s responsibility.

§Errors

Returns an error when opening the new run, spawning the writer, or blocking on the initial entry ack fails.

Source

fn snapshot_anchorer(&self) -> Option<SnapshotAnchorer>

Returns a snapshot anchorer for the currently open run, when capture is active.

The execution engine installs the returned callback so position snapshots commit a matching anchor entry against the durable high-watermark.

Source

fn seal(&mut self, ts_init: UnixNanos)

Seals the open run by writing the terminal entry and updating the manifest.

Idempotent: a closed or absent session is a no-op. Halted sessions defer the seal to the next-boot recovery sweep.

Source

fn run_id(&self) -> Option<&str>

Returns the run id of the currently open run, when capture is active.

Source

fn parent_run_id(&self) -> Option<&str>

Returns the configured replay source or recovered parent run id, when present.

Source

fn is_halted(&self) -> bool

Returns whether the implementation has signaled a fail-stop condition.

Provided Methods§

Source

fn is_event_store_replay_configured(&self) -> bool

Returns whether the current config enables event-store replay.

Event-store replay restores cache state and opens a child run for inspection. The kernel promotes this config state to runtime state only after restore and open both succeed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§