Expand description
These files coordinate safe access to a project-root cache: a writer lease ensures only one process updates the cache at a time, and read-marker files let cleanup see which readers are still using the cache.
Writer leases are stored at <storage>/callgraph/<artifact_cache_key>/writer.lease
and <storage>/inspect/<project_scope_key>/writer.lease. They use the
fs_lock JSON format with a writer_epoch nonce so a writer can detect if
another process has taken over before publishing changes or starting SQLite
write transactions.
Read markers track active SQLite readers so cache cleanup can tell when it is
safe to remove old data. They are stored under
<cache-domain>/readers/<generation-label>/<pid>.<hostname>.<created_at_ms>.<seq>.json;
the JSON records the process identity and creation time, mtime is used as a
heartbeat for cleanup across hosts, and the PID is used for cleanup on the
same host. Marker files are created 0600 so they do not expose checkout
activity or let another local user delete a protected marker.
Structs§
- Artifact
Access - Root-scoped capability that distinguishes shared repository artifacts from mutable state private to one checkout.
- Artifact
Publish Epoch - Serializes artifact supersession with the final disk publication step. Advancing an epoch either happens before a stale worker checks and prevents its publish, or after that worker has fully published the still-current generation. This closes the check-then-publish race of a bare atomic epoch.
- Read
Marker - Read
Marker Metadata - Read
Marker Sweep - Writer
Lease
Enums§
Constants§
- READ_
MARKER_ CROSS_ HOST_ STALE_ MS - Cross-host markers cannot use local PID liveness, so they expire after the same conservative 5x stale-heartbeat window used by filesystem locks.
- READ_
MARKER_ TOUCH_ INTERVAL_ MS - Read-marker heartbeats refresh no more often than the filesystem lock heartbeat. Active readers piggyback this on normal read paths instead of spawning a thread per connection.
Functions§
- configure_
artifact_ access - Register the worktree topology already detected by configure so artifact APIs can enforce it without repeating a Git subprocess on every write path.
- protected_
read_ marker_ exists - read_
marker_ dir - storage_
allows_ root_ keyed - sweep_
read_ markers - writer_
lease_ path