Skip to main content

Crate kmp_adapter_embedded

Crate kmp_adapter_embedded 

Source
Expand description

Embedded edition storage adapters (ADR-009).

One EmbeddedKernelStore opens one data directory (ADR-012 layout: FORMAT_VERSION plus an engine-named file under store/) and implements every persistence port the kernel needs: graph reads (materialized adjacency per ADR-010), node details, the append-only context event log, projection runtime state, and snapshots. SQLite and the redb compatibility engine are fsync-durable, so the crash contract is: no data loss beyond the in-flight event, no duplicate application on replay.

The observable semantics are pinned by kmp-conformance: the same suite that certifies the in-memory kernel store and the Neo4j/Valkey adapters runs against this store.

Structs§

BundleEventRange
Inclusive positions in the exported event stream. A full-store snapshot starts at one; an empty snapshot has neither bound.
BundleHeader
First line of a bundle file: identity and integrity metadata for fail-fast import. Fields added in bundle format 2 default only so format-1 bundles remain readable; every format-2 field is validated before replay.
EmbeddedKernelStore
Every kernel persistence port on one local store.
ImportReport
Outcome of an import: events replayed and projections rebuilt.
ProjectionRebuildReport
Outcome of a projection rebuild from the append-only event log.
QualityTelemetryRetention
Bounded-journal policy for local quality observations.
RedbQualityTelemetryReader
Read-only query adapter for the local quality journal.
RedbQualityTelemetryWriter
Relaxed-durability writer for telemetry/quality.redb.
StoreMigrationReceipt
What a migration did, kept in the store it produced.

Enums§

StorageEngine
The engine behind a data directory’s store/. Chosen once, when the directory is created; recorded as its FORMAT_VERSION; never guessed.

Constants§

BUNDLE_FORMAT_VERSION
EVENT_FORMAT_VERSION
The logical shape of the event log — what a bundle carries and what a migration translates. Independent of the engine: a redb store and a SQLite store export byte-identical bundles.
SUPPORTED_FORMAT_VERSION
The layout this binary creates for a fresh data directory, and the one it has always created: redb (ADR-009).

Functions§

format_version_path
merge_bundles
Merges only histories that have a deterministic answer: identical streams or one exact prefix of the other. Two branches that both appended at the same position are a semantic conflict, so KMP refuses to invent an order.
quality_telemetry_path
read_stamped_version
The version stamped in data_dir, without applying the gate.
store_file_path_for
Where engine keeps its store inside data_dir.
verify_bundle
Validates a bundle without opening or mutating a store. This is the recovery check: identity, range, about coverage and digest are all proved before an operator trusts a saved copy.