Documentation
¶
Overview ¶
Package history is the append-only audit log for agentmutex: every lease state change (acquired, renewed, released, force-released, expired, reclaimed) is recorded in a SQLite database at <root>/history.db.
Recording is strictly BEST-EFFORT: the lock protocol's correctness never depends on the history database. Callers treat any error here as a warning at most — a full disk or a corrupt history.db must never block a deploy from acquiring or releasing its lease.
Concurrency: many CLI processes append concurrently. WAL mode plus a busy timeout makes multi-process appends safe; writes happen outside the per-key flock guard so they never extend a lock critical section.
Index ¶
Constants ¶
const ( EventAcquired = "acquired" EventRenewed = "renewed" EventReleased = "released" EventForceReleased = "force-released" EventExpired = "expired" // lease ended by TTL (displaced or pruned) EventReclaimed = "reclaimed" )
Event types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ID int64 `json:"id"`
TS time.Time `json:"ts"`
Key string `json:"key"`
Event string `json:"event"`
LeaseID string `json:"lease_id,omitempty"`
Agent string `json:"agent,omitempty"`
PID int `json:"pid,omitempty"`
Host string `json:"host,omitempty"`
Reason string `json:"reason,omitempty"`
TTLSeconds float64 `json:"ttl_seconds,omitempty"`
HeldSeconds float64 `json:"held_seconds,omitempty"`
Detail string `json:"detail,omitempty"`
}
Event is one row of the lock changelog. LeaseID correlates all events of a single lease (it is public — never the lease token).
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log is a handle on the history database.
func Open ¶
Open opens (creating if needed) the history database under root. The file is created 0600-equivalent via SQLite defaults inside the 0700 state root.