lockfile

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BundleKey

type BundleKey = string

BundleKey is a canonical key like "php:8.4.6:linux:x86_64:nts".

func ExtBundleKey

func ExtBundleKey(name, version, phpVersion, osName, arch, ts string) BundleKey

ExtBundleKey constructs a canonical key for an extension bundle.

func PHPBundleKey

func PHPBundleKey(version, osName, arch, ts string) BundleKey

PHPBundleKey constructs a canonical key for a PHP core bundle.

func ToolBundleKey

func ToolBundleKey(name, version string) BundleKey

ToolBundleKey constructs a canonical key for a tool bundle.

type Digest

type Digest = string

Digest is a content-addressed SHA-256 digest like "sha256:abc123".

type Entry added in v1.2.0

type Entry struct {
	Digest   string `json:"digest"`
	SpecHash string `json:"spec_hash,omitempty"`
}

Entry pairs a bundle digest with the spec_hash of the inputs that produced it. Empty SpecHash means the entry predates the spec_hash era and is grandfathered (treated as fresh until something forces a rebuild).

type Lockfile

type Lockfile struct {
	SchemaVersion int                 `json:"schema_version"`
	GeneratedAt   time.Time           `json:"generated_at"`
	Bundles       map[BundleKey]Entry `json:"bundles"`
}

Lockfile represents the bundles.lock JSON structure.

func Parse

func Parse(data []byte) (*Lockfile, error)

Parse parses a lockfile from JSON bytes. Accepts schema v1 (values are bare digest strings) and v2 (values are Entry objects). v1 entries are migrated in memory to Entry{Digest: <string>, SpecHash: ""}.

func ParseFile

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

ParseFile reads and parses a lockfile from disk.

func (*Lockfile) Lookup

func (lf *Lockfile) Lookup(key BundleKey) (Digest, bool)

Lookup returns the digest for a bundle key, or false if not found. Kept for backward compatibility with existing callers that only need the digest.

func (*Lockfile) LookupEntry added in v1.2.0

func (lf *Lockfile) LookupEntry(key BundleKey) (Entry, bool)

LookupEntry returns the full Entry for a bundle key, or false if not found.

func (*Lockfile) Set

func (lf *Lockfile) Set(key BundleKey, digest Digest)

Set adds or updates a bundle entry with digest only; spec_hash becomes empty. Prefer SetEntry for callers that know the spec_hash.

func (*Lockfile) SetEntry added in v1.2.0

func (lf *Lockfile) SetEntry(key BundleKey, entry Entry)

SetEntry adds or updates a full bundle entry.

func (*Lockfile) Write

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

Write serializes the lockfile to disk as indented JSON.

Jump to

Keyboard shortcuts

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