state

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSource

func AddSource(path string, makeDefault bool) (Registry, Source, error)

func AddSourceWithInit

func AddSourceWithInit(path string, makeDefault bool, initOptions manifest.InitOptions) (Registry, Source, error)

func FileChecksum

func FileChecksum(path string) (string, error)

func RemoveCopy

func RemoveCopy(record Copy) error

func RemoveSource

func RemoveSource(id string) (Registry, Source, bool, error)

func Save

func Save(registry Registry) error

func SetDefault

func SetDefault(id string) (Registry, Source, bool, error)

func UpsertCopy

func UpsertCopy(record Copy) error

Types

type Copy

type Copy struct {
	Source         string
	Context        string
	Package        string
	Path           string
	Target         string
	SourceChecksum string
	TargetChecksum string
	TargetMode     string
}

type ErrState

type ErrState string
const (
	ErrInvalid          ErrState = "invalid state"
	ErrChecksumMismatch ErrState = "state checksum mismatch"
	ErrSourceRoot       ErrState = "source root"
	ErrWrite            ErrState = "state write"
)

func (ErrState) Error

func (e ErrState) Error() string

type Registry

type Registry struct {
	Sources []Source
	Default string
	Copies  []Copy
}

func Load

func Load() (Registry, error)

func (Registry) CopyByEntry

func (r Registry) CopyByEntry(source, context, packageName, rel string) (Copy, bool)

func (Registry) CopyByTarget

func (r Registry) CopyByTarget(source, context, target string) (Copy, bool)

func (Registry) EnabledSources

func (r Registry) EnabledSources() []Source

type Source

type Source struct {
	ID       string
	Path     string
	Enabled  bool
	Manifest manifest.Manifest
}

Jump to

Keyboard shortcuts

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