Metakit / @doeixd/metakit/artifact

EvidenceStore

class · packages/metakit/src/evidenceStore.ts:28

class EvidenceStore extends Context.Service<
  EvidenceStore,
  KeyValueStore.KeyValueStore
>()('@doeixd/metakit/EvidenceStore') {}

A key-value store of evidence. Prove.machine and Prove.fn read it where it is provided and prove as before where it is not; @doeixd/metakit/sql/stored needs it. A key is an EvidenceKey, which covers the definition's hash and the reader's identity, so an entry is never served for a changed definition or reader. layerMemory keeps it for a process, layerFileSystem(directory) across runs (it needs Effect's FileSystem and Path), and layer over any KeyValueStore. A store that fails to read or write is a defect, not a miss; a value that does not decode is a miss and is written again.

In the guides

Members

EvidenceStore.layer

property · packages/metakit/src/evidenceStore.ts:32

readonly layer: Layer.Layer<EvidenceStore, never, KeyValueStore.KeyValueStore>

Over the KeyValueStore in context.

EvidenceStore.layerMemory

property · packages/metakit/src/evidenceStore.ts:35

readonly layerMemory: Layer.Layer<EvidenceStore>

Kept for the life of the layer.

EvidenceStore.layerFileSystem

property · packages/metakit/src/evidenceStore.ts:40

readonly layerFileSystem: (
  directory: string,
) => Layer.Layer<EvidenceStore, PlatformError, FileSystem | Path>

One file per key in directory, which it must not share with anything else.