Skip to main content

Module registry

Module registry 

Source
Expand description

The registry: the co-tenant tables behind the family adapter pattern (ADR-019 §3–4, substrate.md §registry, POC-R’s validated shape) — the engine-generic half of the family.

One trait pair, two implements per surface:

  • RegistryRead — the sync read side (resolve): the advertisement path’s hot read. No async, no I/O — implementors serve in-memory state. A miss is definitive: implementations promise the whole record table as their cached set, so resolve never falls through to backing-store I/O. The unknown-repo ≡ unauthorized rule (ADR-008) is evaluated at resolve’s caller — this trait returns None and leaks no more than that.
  • RegistryWrite — the async write side: RegistryWrite::put / RegistryWrite::update / RegistryWrite::remove plus the reconcile machinery’s RegistryWrite::watermark / RegistryWrite::rows_since. Every mutation assigns the mutation’s monotone sequence number inside the row-write transaction (transactionally exact — the watermark’s anchor, ADR-019 §5) and returns it; write-side announce (publish/notify/ enqueue) is the reactor’s post-commit business, never the pair’s.

The complete in-memory implementations:

  • InMemoryRegistry — the in-memory default adapter, the batteries-included degenerate case: always-populated, always-correct, single-process, stamp-free (ADR-024 §6), no engine dependency; the completeness shape in the crate’s base (no feature gates — the ADR-025 placement rule).
  • CachedRegistryProvider — the coherence contract’s read side (ADR-019 §4, POC-R’s named deliverable): the whole record table as one immutable snapshot swapped under a short lock; the hot path is one lock read + Arc clone + lookup with zero I/O; invalidation is write-through on the store’s own writes plus wake-driven/tick-driven whole-table refreshes (the delivery wiring is the reactor module’s); refresh failures leave the previous snapshot serving.
  • RegistryBackend — the binding of the pair onto the core’s published registry traits (GitRegistry / GitRegistryStore): resolve over the read side (a miss on the whole-table snapshot is a definitive unresolved id — RegistryError::NotFound; the unknown ≡ unauthorized collapse stays at resolve’s wire-layer caller), put_repo/update_repo/remove_repo over the write side with write-through on the optional provider. The in-memory adapter is the first complete impl (bound via RegistryBackend::with_cached_provider over InMemoryRegistry — the mem pair is test-only now, review 006 R-4; the production mem composition is the entry’s mem shape); the engine twins implement the same pair so the same wrapper binds over them.

The exact Rust names pinned here are the OQ-03 substrate-side inventory for this wave’s members: RegistryRead, RegistryWrite, RegistryRow, InMemoryRegistry, CachedRegistryProvider, RegistryBackend.

Structs§

CachedRegistryProvider
The coherence contract as a type (ADR-019 §4, POC-R’s named deliverable; substrate.md §the coherence contract) — the cached read provider the advertisement path rides:
InMemoryRegistry
The in-memory default adapter — the batteries-included degenerate case of the family: always-populated, always-correct, single-process; the completeness shape in the crate’s base (no engine dependency, stamp-free per ADR-024 §6 — it builds fresh every construction).
RegistryBackend
The registry backend — the pair bound onto the core’s published registry traits (GitRegistry / GitRegistryStore); the first complete impl is the in-memory binding (test-only now — review 006 R-4, the bare mem pair is not a production surface; the production mem composition is the entry’s mem shape) and the engine twins bind through the same type.
RegistryRow
One durable registry row — the record plus its mutation sequence number.

Constants§

HEAD_SEED_TARGET
The v1 HEAD seed target — the unborn symref row both engine twins’ record-write transactions insert (substrate.md §refs pins the value; a constructor knob is additive later, two-way — the row is CAS-rewriteable).

Traits§

RegistryRead
The sync read side of the family adapter pair — the advertisement path’s hot read (the alkcall OwnershipProvider posture, POC-R’s validated shape).
RegistryWrite
The async write side of the family adapter pair (the alkcall OwnershipStore posture).