resolve

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package resolve pins symbolic element references to immutable descriptors. Resolution is deliberately pure: it never loads code, opens a provider, or acquires any runtime resource.

Index

Constants

View Source
const LockFormatVersion = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

Catalog is an in-memory collection of immutable descriptor revisions. It is safe for concurrent readers and registrations during process startup.

func NewCatalog

func NewCatalog() *Catalog

NewCatalog returns an empty descriptor catalog.

func (*Catalog) Exact

func (catalog *Catalog) Exact(identity element.Identity) (element.Descriptor, bool)

Exact returns the descriptor whose complete identity matches identity.

func (*Catalog) Latest

func (catalog *Catalog) Latest(name string) (element.Descriptor, bool)

Latest returns the highest registered revision for name.

func (*Catalog) Names

func (catalog *Catalog) Names() []string

Names returns all registered symbolic names in lexical order.

func (*Catalog) Register

func (catalog *Catalog) Register(descriptor element.Descriptor) error

Register validates and stores an immutable descriptor. Re-registering the exact same descriptor is idempotent; changing content without incrementing Revision is rejected.

func (*Catalog) Revision

func (catalog *Catalog) Revision(name string, revision uint64) (element.Descriptor, bool)

Revision returns a descriptor by symbolic name and revision, regardless of digest. It is used to produce a useful stale-lock diagnostic.

type Entry

type Entry struct {
	Reference string           `json:"reference" yaml:"reference"`
	Identity  element.Identity `json:"identity" yaml:"identity"`
}

Entry pins one symbolic reference to an immutable descriptor identity. Reference and Identity.Name differ only when a future alias or contract reference resolves to an implementation descriptor.

type Lock

type Lock struct {
	FormatVersion uint64  `json:"format_version" yaml:"format_version"`
	Entries       []Entry `json:"elements" yaml:"elements"`
}

Lock is the generated, reviewable resolution artifact consumed by normal builds. Entries are canonicalized when encoded.

func NewLock

func NewLock() Lock

NewLock creates an empty lock at the current format version.

func ParseLock

func ParseLock(source []byte) (Lock, error)

ParseLock decodes strict JSON and rejects unknown fields and trailing data.

func (Lock) Canonical

func (lock Lock) Canonical() (Lock, error)

Canonical returns a validated, independently owned lock with sorted entries.

func (Lock) Equal

func (lock Lock) Equal(other Lock) bool

Equal reports semantic equality independent of entry ordering.

func (Lock) Lookup

func (lock Lock) Lookup(reference string) (element.Identity, bool)

Lookup returns the identity pinned for reference.

func (Lock) Marshal

func (lock Lock) Marshal() ([]byte, error)

Marshal returns deterministic, newline-terminated JSON suitable for a generated openrealtime.lock file.

func (Lock) Validate

func (lock Lock) Validate() error

Validate checks identities and uniqueness without requiring canonical input ordering.

type Mode

type Mode uint8

Mode controls whether resolution consumes an existing lock or deliberately updates it. Normal compilation must use Locked.

const (
	Locked Mode = iota
	Update
)

type Result

type Result struct {
	Descriptors map[string]element.Descriptor
	Lock        Lock
}

Result contains descriptors keyed by the requested symbolic references and the exact lock covering those references.

func Resolve

func Resolve(catalog *Catalog, references []string, lock Lock, mode Mode) (Result, error)

Resolve pins each unique reference. Update deliberately selects the latest registered revision and emits a new minimal lock; Locked verifies every existing digest and rejects missing entries.

Jump to

Keyboard shortcuts

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