Skip to main content

Module def_record_lock

Module def_record_lock 

Source
Expand description

A cross-process lock per shared definition record (docs/specs/SPEC_FORK_SLUG_MIGRATION_2026_10_22.md P0.2).

Every channel and instance on the host writes these records, each with its own DefinitionStore. An update reads the record, keeps its slug and former slugs (keep_slug_and_former_slugs), and writes it back. Without a lock spanning all three, another writer can land in between, and the write-back reverts its slug or drops a former slug it just recorded. The lock is an OS file lock (LockFileEx / flock, through std) on <root>/locks/<id>.lock, which binds one open handle, so it serializes writers in this process as well as in others. Lock files are never removed: deleting one while another writer waits on it would hand two writers two different locks.