Documentation
¶
Overview ¶
Package lock reads and writes .fullsend/lock.yaml files that pin all resolved remote dependencies (URLs and integrity hashes) for reproducible harness execution. A lock file is produced by `fullsend lock <harness>` and consumed by the resolver to skip re-resolution when dependencies have not changed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Save ¶
Save writes the lock file to path atomically (write to temp, then rename). Parent directories are created as needed. The file is written with 0o644 permissions (world-readable) because lock files are meant to be committed to version control, unlike cache files which use 0o600.
Save mutates lf.Version to currentVersion when it is zero.
Types ¶
type DependencyEntry ¶
type DependencyEntry struct {
Field string `yaml:"field"`
URL string `yaml:"url"`
SHA256 string `yaml:"sha256"`
Type string `yaml:"type,omitempty"` // "file" or "directory"; empty treated as "file"
Files []FileEntry `yaml:"files,omitempty"` // manifest of files (directory deps only)
FetchedAt time.Time `yaml:"fetched_at"`
TransitiveDeps []DependencyEntry `yaml:"transitive_deps,omitempty"`
}
DependencyEntry records a single resolved remote resource.
type HarnessLock ¶
type HarnessLock struct {
Source string `yaml:"source"`
SHA256 string `yaml:"sha256"`
ResolvedAt time.Time `yaml:"resolved_at"`
Dependencies []DependencyEntry `yaml:"dependencies"`
}
HarnessLock records resolved dependencies for one harness.
func (*HarnessLock) IsStale ¶
func (hl *HarnessLock) IsStale(sourceHash string) bool
IsStale returns true if the harness source file has changed since the lock entry was generated. It compares the harness file's SHA256 against the stored hash. sourceHash is the SHA256 of the current harness file content. Returns true for a nil receiver.
func (*HarnessLock) LookupDep ¶
func (hl *HarnessLock) LookupDep(url string) *DependencyEntry
LookupDep searches the dependency list (including transitive deps, depth-first) for the given URL and returns the matching entry or nil. The returned pointer references the live slice — mutations update the underlying Dependencies. Returns nil for a nil receiver.
type LockFile ¶
type LockFile struct {
Version int `yaml:"version"`
GeneratedAt time.Time `yaml:"generated_at"`
Harnesses map[string]HarnessLock `yaml:"harnesses"`
}
LockFile is the top-level structure of .fullsend/lock.yaml.
func (*LockFile) HarnessNames ¶
HarnessNames returns the sorted list of harness names in the lock file.
func (*LockFile) Lookup ¶
func (lf *LockFile) Lookup(harnessName string) *HarnessLock
Lookup returns the HarnessLock entry for the named harness, or nil if not found. Returns nil for a nil receiver. The returned pointer is a snapshot — mutations do not update the LockFile map. Use SetHarness to modify entries.
func (*LockFile) SetHarness ¶
func (lf *LockFile) SetHarness(name string, hl HarnessLock)
SetHarness adds or replaces the lock entry for the named harness. Intended for use by the lock file generator (fullsend lock); callers should use Save to persist changes. No-op on a nil receiver.