manifest

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package manifest reads and writes the .awf/awf.lock and detects drift between rendered output and its sources.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedLiveSource = errors.New("unsupported live source")

ErrUnsupportedLiveSource identifies authority that cannot be dispatched by a live operation.

Functions

func Hash

func Hash(b []byte) string

Hash returns the stable content address used by the lock and attestation.

func LoadSchemaConfinedOptional added in v0.49.0

func LoadSchemaConfinedOptional(root, path string) (int, bool, error)

LoadSchemaConfinedOptional reads only the schema stamp through the same safe regular-file boundary used for full live authority capture.

func NormalizeSemver added in v0.22.0

func NormalizeSemver(s string) (string, bool)

func ValidateLive added in v0.40.0

func ValidateLive(l *Lock, floor, current int) error

ValidateLive accepts only authority a user-invoked operation may dispatch on.

func WriteFileAtomic added in v0.11.0

func WriteFileAtomic(path string, data []byte) error

WriteFileAtomic writes data through a same-directory temporary file and rename, so a failed write never leaves a truncated destination.

func WriteFileAtomicMode added in v0.30.0

func WriteFileAtomicMode(path string, data []byte, mode os.FileMode) error

WriteFileAtomicMode is WriteFileAtomic with an explicit final mode, used when a restored file's recorded permissions must survive the replacement.

Types

type AuthorityState added in v0.22.0

type AuthorityState uint8

AuthorityState identifies the sole supported permanent lock authority.

const AuthorityPermanent AuthorityState = 1

type Drift

type Drift struct{ Path, Kind, Detail string }

type Entry

type Entry struct {
	TemplateID   string `json:"templateId"`
	TemplateHash string `json:"templateHash"`
	ConfigHash   string `json:"configHash"`
	OutputHash   string `json:"outputHash"`
	// Mode records the managed file's permission bits so retirement can preserve
	// a mode-only user change before deleting the formerly managed path. Older
	// locks omit it and retain the historical regular-file 0644 expectation.
	Mode uint32 `json:"mode,omitempty"`
	// RegenChecked marks an entry whose drift is checked by regeneration rather
	// than by the frozen OutputHash: generated indexes and navigation plus
	// in-place-editable files. Omitted when false so a plain entry's
	// serialization is unchanged.
	RegenChecked bool `json:"regenChecked,omitempty"`
}

type LiveFile added in v0.49.0

type LiveFile struct {
	Lock    *Lock
	Content []byte
	Mode    fs.FileMode
}

LiveFile is one safely captured regular lock file and its parsed live model.

func LoadLiveFileOptional added in v0.49.0

func LoadLiveFileOptional(root, path string, floor, current int) (LiveFile, bool, error)

LoadLiveFileOptional reads a live lock through a root-confined, no-follow, nonblocking regular-file boundary and parses exactly those captured bytes.

type LiveSourceError added in v0.40.0

type LiveSourceError struct{ Schema, Floor, Current int }

LiveSourceError carries live compatibility facts without recovery presentation.

func (*LiveSourceError) Error added in v0.40.0

func (e *LiveSourceError) Error() string

func (*LiveSourceError) Is added in v0.40.0

func (e *LiveSourceError) Is(target error) bool

type Lock

type Lock struct {
	AWFVersion             string           `json:"awfVersion"`
	SchemaVersion          int              `json:"schemaVersion"`
	Files                  map[string]Entry `json:"files"`
	InitializedWithVersion string           `json:"initializedWithVersion,omitempty"`
}

func Load

func Load(path string) (*Lock, error)

func LoadOptional added in v0.11.0

func LoadOptional(path string) (*Lock, bool, error)

func Parse added in v0.22.0

func Parse(b []byte) (*Lock, error)

Parse rejects retired routing keys at every schema. Historical decoding is owned by audit rather than the live manifest model.

func ParseLive added in v0.40.0

func ParseLive(b []byte, floor, current int) (*Lock, error)

func (*Lock) AuthorityState added in v0.22.0

func (l *Lock) AuthorityState() (AuthorityState, error)

AuthorityState validates permanent lock authority. Older adopters may omit initialization provenance and remain valid permanent authority.

func (*Lock) Clone added in v0.40.0

func (l *Lock) Clone() *Lock

Clone returns a fully independent lock projection.

func (*Lock) Marshal added in v0.18.0

func (l *Lock) Marshal() ([]byte, error)

func (*Lock) Save

func (l *Lock) Save(path string) error

type PartialAuthorityError added in v0.40.0

type PartialAuthorityError struct{ Config, Lock bool }

PartialAuthorityError identifies an incomplete control pair without prescribing recovery.

func (*PartialAuthorityError) Error added in v0.40.0

func (e *PartialAuthorityError) Error() string

Jump to

Keyboard shortcuts

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