Documentation
¶
Overview ¶
Package scopelease implements bounded local scope leases so several agents sharing one worktree cannot silently edit overlapping files or the same ticket. Lease state is private derived state under .corvint/leases; it is never an input to ranking, learning, evidence, or authority, and it enforces nothing about the edits an agent actually makes.
Index ¶
Constants ¶
View Source
const ( // MaxTTL bounds one acquisition or renewal. MaxTTL = 24 * time.Hour // StaleLockAge is the age after which a lock file is treated as crashed. StaleLockAge = 30 * time.Second // LockWait bounds how long a writer waits for the single-writer lock. LockWait = 2 * time.Second )
View Source
const SchemaVersion = 1
SchemaVersion is the on-disk lease document version.
Variables ¶
View Source
var ( ErrConflict = errors.New("scopelease: scope conflict") ErrNotFound = errors.New("scopelease: lease not found") ErrHolderMismatch = errors.New("scopelease: holder does not hold this lease") ErrLockBusy = errors.New("scopelease: lease lock is held by another writer") // ErrInvalidRequest marks a caller-supplied argument refused before any // lease state is read; the refusal keeps its own message. ErrInvalidRequest = errors.New("scopelease: invalid request") )
Sentinel errors. Callers use errors.Is.
Functions ¶
Types ¶
type Conflict ¶
type Conflict struct {
LeaseID string `json:"lease_id"`
Holder string `json:"holder"`
Reason string `json:"reason"`
Scope string `json:"scope"`
}
Conflict explains why a scope could not be claimed, or why a touched path is not covered by exactly one live lease.
type Lease ¶
type Lease struct {
SchemaVersion int `json:"schema_version"`
ID string `json:"lease_id"`
Holder string `json:"holder"`
Paths []string `json:"paths"`
Ticket string `json:"ticket"`
Note string `json:"note"`
AcquiredAt string `json:"acquired_at"`
ExpiresAt string `json:"expires_at"`
Revision string `json:"revision"`
}
Lease is one recorded local scope claim.
Click to show internal directories.
Click to hide internal directories.