Skip to main content

insert_and_append

Function insert_and_append 

Source
pub fn insert_and_append(
    store: &GriteStore,
    wal: &WalManager,
    actor: &ActorId,
    event: &Event,
) -> Result<InsertResult, GriteError>
Expand description

Insert an event into both the sled store and the Git WAL

This is the canonical way to persist an event. It:

  1. Inserts the event into the sled store (for fast querying)
  2. Appends the event to the Git WAL (for durability and sync)

If WAL append fails, the event is still persisted in sled and an error is logged but not returned.