Skip to main content

Module git_store

Module git_store 

Source
Expand description

Git-backed event store satisfying the GASP store contract (the rules restated inline here are authoritative for this crate; the full spec lives in the gasp repo’s SPEC.md):

  1. Durable append, boundary commit. Every append opens the log in append mode, writes, flushes, and fsyncs (plus a parent-directory fsync when the log file is first created), so a crash loses at most the batch being written. A crash mid-write can leave a torn final line; scan reports it with a recovery hint rather than reading past it. commit_run makes the one closing git commit per run boundary.
  2. The lease lives inside the append path. append takes or renews the cross-process lease at .agent/lease (local-only, gitignored) before writing; acquisition races on the lease file are decided by an atomic exclusive create. worker_id MUST be unique per worker — two processes sharing a worker id are treated as the same writer. Residual caveat: stealing an expired lease has a narrow three-process race window, and file-based leases are advisory on network filesystems.

Structs§

GitEventStore

Constants§

DEFAULT_EVENTS_PATH
LEASE_PATH

Functions§

init_agent_repo
Convenience for examples/tests: initialize a git repo suitable as an agent repo (git init + minimal AGENT.md/identity), returning the store.