@me2em/pact
    Preparing search index...

    Class MemoryStore

    In-memory JournalStore: CAS-append with early chain checks (ph/sq must chain onto the current head — cheap fail-closed defense before the caller's verify), snapshot reads. The tail evHash is maintained incrementally (F-rc3-2) — O(1) per append instead of re-deriving it from the last event on every call.

    const store = new MemoryStore();
    await store.append(ZERO32, genesis);
    console.log(await store.head()); // evHash(genesis)

    Implements

    Index
    • CAS-append with early chain checks: head match, then ph and sq must chain onto the current state — a cheap fail-closed defense before the caller's verify (F-rc3-2 keeps the tail hash O(1)).

      Parameters

      • expectedHead: string

        The JournalHead the caller observed.

      • event: Event

        The event to append.

      Returns Promise<void>

      PactError FORK_DETECTED @ store when the head has moved since observation or the event does not chain onto it.