Skip to content

MemoryStorage

In-memory reference implementation of the Storage port.

State lives in a MemoryStore that outlives any one opened Storage, so tests can simulate a crash: close the layer that owns a Harness mid-work, then open a new one over the same store. Reads and retained writes are detached copies, matching the ownership boundary of serializing backends.

Since v0.0.0


Durable state of one in-memory “database”. Shared by every Storage opened over it.

Signature

declare class MemoryStore

Source

Since v0.0.0

Signature

readonly recordTypes: Map<number, TableName>

Source

Signature

readonly conversations: Map<any, ConversationRecord>

Source

Signature

readonly conversationIds: Array<any>

Source

conversationIdsByOwnerConversation (property)

Section titled “conversationIdsByOwnerConversation (property)”

Signature

readonly conversationIdsByOwnerConversation: Map<any, Array<any>>

Source

Signature

readonly conversationIdsByOwnerTask: Map<any, Array<any>>

Source

Signature

readonly entries: Map<any, EntryRecord>

Source

Signature

readonly entryIds: Map<any, Array<any>>

Source

Signature

readonly headEntryIds: Map<any, Array<any>>

Source

Signature

readonly entryCommitSeqs: Map<any, any>

Source

Signature

readonly tasks: Map<any, TaskRecord>

Source

Signature

readonly taskIds: Array<any>

Source

Signature

readonly taskIdsByStatus: Record<"pending" | "running" | "waiting" | "completing" | "terminal", Array<any>>

Source

Signature

readonly submissions: Map<any, SubmissionRecord>

Source

Signature

readonly submissionIds: Array<any>

Source

Signature

readonly submissionIdsByStatus: Record<"queued" | "placed" | "done" | "unanswered", Array<any>>

Source

Signature

readonly submissionIdsByRequest: Map<any, Map<string, any>>

Source

Signature

readonly documents: Map<any, StoredDocumentState>

Source

Signature

readonly documentAddresses: Map<string, AddressIndex>

Source

Signature

readonly documentIdsByScope: Map<string, Array<any>>

Source

Next mint candidate; ID 1 is reserved for the root conversation.

Signature

nextId: number

Source

Signature

nextSeq: number

Source

A Storage over a fresh store that is discarded with the layer.

Signature

declare const layer: Layer.Layer<Storage>

Source

Since v0.0.0

Open a Storage over an existing store. Closing the layer’s scope closes this handle only; the store keeps its state for the next opener.

Signature

declare const layerFromStore: (store: MemoryStore) => Layer.Layer<Storage>

Source

Since v0.0.0

A fresh, empty store.

Signature

declare const makeStore: () => MemoryStore

Source

Since v0.0.0