Skip to main content

Module def_store

Module def_store 

Source
Expand description

DefinitionStore — file-per-definition CRUD on <root>/<id>.json with a sibling retired/<id>.json tombstone tree.

Sibling of store.rs (the named-instance Registry). Same on-disk discipline: atomic rename for cross-process safety, a forward-compat merge that preserves unknown fields, refuses schema downgrades, and never clobbers an unparseable file. Holds the GLOBAL agent-definition roster so any channel/version sees the same agents (P0.2 of docs/specs/SPEC_CROSS_CHANNEL_AGENT_PERSISTENCE_2026-06-13.md).

The forward-compat merge helpers below intentionally parallel the private ones in store.rs. They are kept separate (not shared) so this addition is fully isolated from the in-production instance registry; a later cleanup can extract a generic file-store both use.

Structs§

DefinitionStore
LockedRecord
One definition record, locked by DefinitionStore::with_record_locked.
SlugAllocationLock
A held host-wide lock: slug allocation (DefinitionStore::lock_slug_allocation) or seat changes (DefinitionStore::lock_seat_graph).

Enums§

DefStoreError

Functions§

record_bytes
A definition record as DefinitionStore writes one after a merge: pretty JSON and a trailing newline.