lockfile

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateIntegrity

func CalculateIntegrity(dir string) (string, error)

CalculateIntegrity calculates a SHA256 hash of a directory's contents

func VerifyIntegrity

func VerifyIntegrity(dir string, expected string) (bool, error)

VerifyIntegrity checks if a directory matches the expected integrity hash

Types

type LockedEntry

type LockedEntry struct {
	Source      string    `json:"source"`              // Git URL or alias
	Version     string    `json:"version,omitempty"`   // Semver version if available
	Commit      string    `json:"commit,omitempty"`    // Git commit hash
	Integrity   string    `json:"integrity,omitempty"` // SHA256 hash of installed files
	InstalledAt time.Time `json:"installedAt"`
	UpdatedAt   time.Time `json:"updatedAt,omitempty"`
}

LockedEntry represents a locked server entry

type Lockfile

type Lockfile struct {
	Version string                  `json:"version"`
	Locked  map[string]*LockedEntry `json:"locked"`
	// contains filtered or unexported fields
}

Lockfile represents the agentctl.lock file that tracks exact versions

func Load

func Load(configDir string) (*Lockfile, error)

Load loads a lockfile from a config directory

func LoadFrom

func LoadFrom(path string) (*Lockfile, error)

LoadFrom loads a lockfile from a specific path

func New

func New() *Lockfile

New creates a new lockfile

func (*Lockfile) Count

func (lf *Lockfile) Count() int

Count returns the number of locked entries

func (*Lockfile) Entries

func (lf *Lockfile) Entries() map[string]*LockedEntry

Entries returns all locked entries

func (*Lockfile) Get

func (lf *Lockfile) Get(name string) (*LockedEntry, bool)

Get returns a locked entry if it exists

func (*Lockfile) IsLocked

func (lf *Lockfile) IsLocked(name string) bool

IsLocked checks if a server is locked

func (*Lockfile) Lock

func (lf *Lockfile) Lock(name string, entry *LockedEntry)

Lock adds or updates a locked entry

func (*Lockfile) NeedsUpdate

func (lf *Lockfile) NeedsUpdate(name string, newCommit, newVersion string) bool

NeedsUpdate checks if a locked entry needs updating Returns true if the commit or version has changed

func (*Lockfile) Path

func (lf *Lockfile) Path() string

Path returns the lockfile path

func (*Lockfile) Save

func (lf *Lockfile) Save() error

Save saves the lockfile to disk

func (*Lockfile) SaveTo

func (lf *Lockfile) SaveTo(path string) error

SaveTo saves the lockfile to a specific path

func (*Lockfile) Unlock

func (lf *Lockfile) Unlock(name string)

Unlock removes a locked entry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL