Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultWorkerType = WorkerType{Determinism: Deterministic, Effectfulness: Effectfulness{Pure: true}}
DefaultWorkerType is assigned to freshly scaffolded components.
Functions ¶
This section is empty.
Types ¶
type Brick ¶
type Brick struct {
Name string
Kind Kind
Dir string // absolute path to the brick directory
ImportPath string // <module>/components/<name> or <module>/bases/<name>
Interface string // interface (public) package name; defaults to Name
WorkerType WorkerType
// Deps holds the names of other bricks this brick imports. It is populated
// by the deps analysis, not by the loader.
Deps []string
}
Brick is a component or a base: a reusable building block living under components/<name> or bases/<name>.
func (*Brick) IsComponent ¶
IsComponent reports whether the brick is a component.
type Determinism ¶
type Determinism string
Determinism is one axis of a worker type: whether the same inputs and world always yield the same result.
const ( Deterministic Determinism = "deterministic" NonDeterministic Determinism = "non_deterministic" )
type Effect ¶
type Effect string
Effect is a single way a worker interacts with the world beyond its declared inputs and outputs.
type Effectfulness ¶
Effectfulness is the second axis: either pure, or a non-empty set of effects. It unmarshals from YAML as either the scalar "pure" or a sequence of effects.
func (Effectfulness) HasEffect ¶
func (e Effectfulness) HasEffect(eff Effect) bool
HasEffect reports whether the worker declares the given effect.
func (Effectfulness) IsEffectful ¶
func (e Effectfulness) IsEffectful() bool
IsEffectful reports whether the worker declares any effect.
func (Effectfulness) MarshalYAML ¶
func (e Effectfulness) MarshalYAML() (any, error)
MarshalYAML renders pure as the scalar "pure" and otherwise a list of effects.
func (Effectfulness) String ¶
func (e Effectfulness) String() string
func (*Effectfulness) UnmarshalYAML ¶
func (e *Effectfulness) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML accepts either "pure" (scalar) or a list of effects (sequence).
type Project ¶
type Project struct {
Name string
Dir string
IsDevelopment bool
Bricks []string // declared brick names (from project.yaml)
}
Project is a deployable artifact (or the development project) composed of a declared set of bricks.
type TagPatterns ¶
TagPatterns configures how stable/release points are recognised in the VCS.
type WorkerType ¶
type WorkerType struct {
Determinism Determinism `yaml:"determinism"`
Effectfulness Effectfulness `yaml:"effectfulness"`
}
WorkerType is the product of the two axes (8 possible values).
func (WorkerType) Merge ¶
func (w WorkerType) Merge(other WorkerType) WorkerType
Merge combines two worker types into the weaker (more permissive) of the two, used to propagate effects/non-determinism through a dependency graph: the result is non-deterministic if either is, and its effects are the union.
func (WorkerType) String ¶
func (w WorkerType) String() string
func (WorkerType) Validate ¶
func (w WorkerType) Validate() error
Validate checks the worker type against the embedded principles vocabulary.
type Workspace ¶
type Workspace struct {
Root string
Module string
TopNamespace string
Components map[string]*Brick
Bases map[string]*Brick
Projects map[string]*Project
TagPatterns TagPatterns
VCS VCS
Warnings []string
}
Workspace is the in-memory model of a goforge workspace, built by the loader.
func (*Workspace) Bricks ¶
Bricks returns all bricks sorted: components first (alphabetical), then bases.
func (*Workspace) SortedProjects ¶
SortedProjects returns projects sorted by name, with development last.