Skip to main content

Crate lex_store

Crate lex_store 

Source
Expand description

M6: content-addressed store. Spec §4.

Filesystem layout (§4.2):

<root>/
├── stages/
│   └── <SigId>/
│       ├── implementations/
│       │   ├── <StageId>.ast.json
│       │   └── <StageId>.metadata.json
│       ├── tests/
│       │   └── <test_id>.json
│       ├── specs/
│       │   └── <spec_id>.json
│       └── lifecycle.json
└── traces/
    └── <run_id>/
        └── trace.json

The filesystem is canonical. We don’t ship index.db (the spec calls it a cache); the in-memory index is rebuilt on Store::open by scanning the filesystem. Acceptance §4.6 requires that this rebuild produces identical results regardless of cache state — the obvious way to honor that is to keep the cache trivially derivable.

Modules§

policy
<store>/policy.json — local trust policy (#181, originally called out in the v3 acceptance criteria for #172).
users
<store>/users.json — actor identity (lex-tea v3d, #172).

Structs§

Branch
Lifecycle
Per-SigId lifecycle log: append-only list of state transitions for every implementation that’s ever been published under this signature.
MergeConflict
MergeEntry
MergeRecord
MergeReport
MergeSummary
Metadata
Per-implementation metadata (<StageId>.metadata.json).
Operation
The operation as a whole — its kind and the causal predecessors it assumes. The OpId is computed from this plus a sorted view of parents.
OperationRecord
An operation paired with its computed OpId and the resulting stage transition. This is what gets persisted under <root>/ops/<OpId>.json once apply.rs (next slice of #129) lands.
PublishOp
One applied operation within a PublishOutcome.
PublishOutcome
The outcome returned by Store::publish_program.
Spec
A spec attached to a SigId (spec §4.4). Kept opaque here — the spec-checker (M10) interprets its body.
StageHistoryEntry
One entry in the per-SigId stage history surfaced by Store::sig_history. Newest-first ordering is the responsibility of the producer.
Store
Test
A test attached to a SigId (spec §4.4).
Transition

Enums§

OperationKind
The kinds of operations that produce stage transitions. Mirrors the initial set in #129; new kinds (MoveBetweenFiles, SplitFunction, ExtractType) can be added later as long as they’re appended at the end of this enum or use explicit #[serde(rename = "...")] tags so existing OpIds stay stable.
StageStatus
StageTransition
Effect of applying an operation on a stage’s content-addressed identity. Used as the produces field of an OperationRecord so consumers can answer “after this op, what’s the head stage for this SigId?” without rerunning the apply step.
StoreError

Constants§

DEFAULT_BRANCH

Type Aliases§

OpId
Identity of an operation. (kind, payload, parents) SHA-256 in lowercase hex (64 chars). Two operations with identical payloads and parent sets produce identical OpIds; the store dedupes on this.