model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 5 Imported by: ? modules, 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 model defines the contracts shared by the bootstrap subsystem: a machine configuration that can be validated, installed and uninstalled, and the providers and groups that organise them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapErrors

func WrapErrors(err error, errs []error) error

WrapErrors wraps err with each of errs in turn, so the last element of errs ends up outermost: WrapErrors(base, [a, b]) reads "b: a: base". Every wrapped error stays reachable through errors.Is and errors.As.

Types

type GroupError added in v0.0.42

type GroupError struct {
	Group string
	// Failures lists the individual steps that failed. Nested groups are
	// flattened, so every entry is a leaf configuration.
	Failures []StepFailure
	// contains filtered or unexported fields
}

GroupError is the error a MachineConfigurationGroup returns when any of its members fail. Its message and errors.Is/As behaviour are those of the members' errors wrapped around the group name; Failures additionally says which member each error came from.

func (*GroupError) Error added in v0.0.42

func (e *GroupError) Error() string

func (*GroupError) Unwrap added in v0.0.42

func (e *GroupError) Unwrap() error

Unwrap exposes the members' errors to errors.Is and errors.As.

type IMachineConfiguration

type IMachineConfiguration interface {
	// Name is a short human-readable label for the configuration.
	Name() string
	// Validate reports whether the configuration is already in place. A
	// non-nil error means it is not (and Install may be able to fix it).
	Validate(ctx context.Context) (out *bytes.Buffer, err error)
	// Install puts the configuration in place. It must be idempotent.
	Install(ctx context.Context) (out *bytes.Buffer, err error)
	// Uninstall removes the configuration where that is safe to automate.
	Uninstall(ctx context.Context) (out *bytes.Buffer, err error)
}

IMachineConfiguration is one piece of workstation state that allbctl knows how to inspect and manage (a directory, a tool, a dotfiles clone...).

Every method returns a non-nil buffer holding human-readable output, even when it also returns an error. The context bounds any external command or network call the implementation makes.

type IMachineConfigurationProvider

type IMachineConfigurationProvider interface {
	GetConfiguration() []IMachineConfiguration
}

IMachineConfigurationProvider supplies the ordered list of configurations that make up a bootstrapped workstation for one operating system.

type MachineConfigurationGroup

type MachineConfigurationGroup struct {
	GroupName string
	Configs   []IMachineConfiguration
}

MachineConfigurationGroup is a named, ordered collection of configurations that is itself a configuration, so groups can be nested and reported on as one section.

func (MachineConfigurationGroup) Install

Install installs every member that does not already validate. Members that validate are reported as-is and left untouched.

func (MachineConfigurationGroup) Name

Name returns the group's name.

func (MachineConfigurationGroup) Uninstall

Uninstall uninstalls every member in reverse order.

func (MachineConfigurationGroup) Validate

Validate validates every member and concatenates their output. It returns an error naming the group when any member is not in place, or when the group is empty.

type StepFailure added in v0.0.42

type StepFailure struct {
	// Step is the Name of the configuration that failed.
	Step string
	Err  error
}

StepFailure names one configuration that failed, and why.

func Failures added in v0.0.42

func Failures(step string, err error) []StepFailure

Failures breaks the error a configuration named step returned down to the individual steps that failed: a group's error becomes one entry per failed member, any other error is a single entry for step itself.

Jump to

Keyboard shortcuts

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