Skip to content

InMemoryJournal

Defined in: src/persistence/journals/InMemoryJournal.ts:17

In-process journal backed by plain arrays. The default plug-in used by tests and dev-mode; data lives only as long as the process and is NOT shared across ActorSystem instances. Serves as reference semantics for all other Journal implementations.

Exposes an in-process JournalEventBus so the query layer can do sub-poll-interval push delivery (see #42).

new InMemoryJournal(): InMemoryJournal

InMemoryJournal

readonly events: JournalEventBus

Defined in: src/persistence/journals/InMemoryJournal.ts:19

Optional in-process notification bus. When present, the read-side query layer subscribes here for sub-poll-interval push delivery (see JournalEventBus). Journals that span processes (Cassandra, Postgres) leave it undefined — the query layer falls back to the polling loop.

Journal.events

_remapForMigration<E, F>(pid, transform): Promise<void>

Defined in: src/persistence/journals/InMemoryJournal.ts:94

Migration hook (#9). Applies transform to every persisted event’s payload under pid, rewriting in place — sequence numbers, timestamps, tags are preserved. Used by migrateInMemoryJournal to wrap legacy raw events into the _v/_t/_e envelope when an actor is retro-fitted with an EventAdapter.

Internal API. Callers should reach for the documented migrateInMemoryJournal helper instead of calling this directly; the underscored prefix marks it as a migration-only escape hatch.

E

F

string

(e) => F

Promise<void>


append<E>(pid, events, expectedSeq, tags?): Promise<PersistentEvent<E>[]>

Defined in: src/persistence/journals/InMemoryJournal.ts:21

Append events to the stream of pid, enforcing optimistic concurrency: the current highest sequence number MUST equal expectedSeq or the call throws JournalConcurrencyError. Returns the written events with their assigned sequence numbers.

E

string

readonly E[]

number

readonly string[]

Promise<PersistentEvent<E>[]>

Journal.append


close(): Promise<void>

Defined in: src/persistence/journals/InMemoryJournal.ts:81

Best-effort teardown; idempotent.

Promise<void>

Journal.close


delete(pid, toSeq): Promise<void>

Defined in: src/persistence/journals/InMemoryJournal.ts:70

Delete events up to and including toSeq — used when compacting past a snapshot.

string

number

Promise<void>

Journal.delete


highestSeq(pid): Promise<number>

Defined in: src/persistence/journals/InMemoryJournal.ts:64

Current highest sequence number for pid — 0 if no events exist.

string

Promise<number>

Journal.highestSeq


persistenceIds(): Promise<string[]>

Defined in: src/persistence/journals/InMemoryJournal.ts:77

Persistence IDs currently known to the journal (useful for projections).

Promise<string[]>

Journal.persistenceIds


read<E>(pid, fromSeq, toSeq?): Promise<PersistentEvent<E>[]>

Defined in: src/persistence/journals/InMemoryJournal.ts:55

Return events in (fromSeq, …, toSeq] order. toSeq defaults to the current highest sequence number. Inclusive bounds — fromSeq is the first event returned, not the “after” cursor.

E

string

number

number

Promise<PersistentEvent<E>[]>

Journal.read