Documentation
¶
Index ¶
- Variables
- func HasAllLabels(labels map[string]string) containers.Option[PhaseOptions]
- func HasLabel(k, v string) containers.Option[PhaseOptions]
- func HasName(name string) containers.Option[PhaseOptions]
- func IsPhase(p Phase) containers.Option[PhaseOptions]
- func WithKind(kind string) containers.Option[EdgeOptions]
- type Descriptor
- type Edge
- type EdgeOptions
- type Metadata
- type Phase
- type PhaseOptions
- type Pipeline
- func (p *Pipeline) AddEdge(e Edge) error
- func (p *Pipeline) AddPhase(phase Phase) error
- func (p *Pipeline) Edges(o ...containers.Option[EdgeOptions]) iter.Seq[Edge]
- func (p *Pipeline) EdgesFrom() map[string]map[string]Edge
- func (p *Pipeline) Metadata() Metadata
- func (p *Pipeline) PhaseByName(name string) (Phase, error)
- func (p *Pipeline) Phases(opts ...containers.Option[PhaseOptions]) iter.Seq[Phase]
- type Resource
- type ResourceWithAnnotations
- type Result
- type RollbackPhase
- type State
- type TriggerableEdge
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when a particular resource cannot be located ErrNotFound = errors.New("not found") // ErrAlreadyExists is returned when an attempt is made to create a resource // which already exists ErrAlreadyExists = errors.New("already exists") // ErrNoChange is returned when an update produced zero changes ErrNoChange = errors.New("update produced no change") )
Functions ¶
func HasAllLabels ¶
func HasAllLabels(labels map[string]string) containers.Option[PhaseOptions]
HasAllLabels causes a call to Phases to list any phase which mataches all the provided labels.
func HasLabel ¶
func HasLabel(k, v string) containers.Option[PhaseOptions]
HasLabel causes a call to Phases to list any phase with the matching label paid k and v.
func HasName ¶
func HasName(name string) containers.Option[PhaseOptions]
HasName causes a call to Phases to list any phase with the matching name.
func IsPhase ¶
func IsPhase(p Phase) containers.Option[PhaseOptions]
IsPhase causes a call to Phases to list specifically the provided phase p.
func WithKind ¶
func WithKind(kind string) containers.Option[EdgeOptions]
Types ¶
type Descriptor ¶
type Descriptor struct {
Kind string `json:"kind"`
Pipeline string `json:"pipeline"`
Metadata Metadata `json:"metadata"`
}
Descriptor is a type which describes a Phase
func (Descriptor) String ¶
func (d Descriptor) String() string
type Edge ¶
type Edge interface {
Kind() string
From() Descriptor
To() Descriptor
Perform(context.Context) (*Result, error)
CanPerform(context.Context) (bool, error)
}
Edge represents an edge between two phases. Edges have have their own kind which identifies their Perform behaviour.
type EdgeOptions ¶
type EdgeOptions struct {
// contains filtered or unexported fields
}
type Metadata ¶
type Metadata struct {
Name string `json:"name"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
Metadata contains the unique information used to identify a named resource instance in a particular phase.
type Phase ¶
type Phase interface {
Descriptor() Descriptor
Get(context.Context) (Resource, error)
History(context.Context) ([]State, error)
}
Phase is the core interface for resource sourcing and management. These types can be registered on pipelines and can depend upon on another for promotion.
type PhaseOptions ¶
type PhaseOptions struct {
// contains filtered or unexported fields
}
PhaseOptions scopes a call to get phases from a pipeline.
func (*PhaseOptions) Matches ¶
func (p *PhaseOptions) Matches(phase Phase) bool
Matches returns true if the provided Phase matches the phase options set of conditions. An empty set of conditions always returns true.
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline is a collection of phases for a given resource type R. It implements the core.Phase interface and is scoped to a single Resource implementation.
func NewPipeline ¶
NewPipeline constructs and configures a new instance of *ResourcePipeline[R]
func (*Pipeline) AddPhase ¶
AddPhase will add the provided resource phase to the pipeline along with configuring any dependent promotion source phases if configured to do so.
func (*Pipeline) Edges ¶
func (p *Pipeline) Edges(o ...containers.Option[EdgeOptions]) iter.Seq[Edge]
Edges returns all edges as a sequence
func (*Pipeline) EdgesFrom ¶
EdgesFrom returns the set of edges as a map of "from" phase names to map of "to" phase names to the edge instance itself.
func (*Pipeline) Metadata ¶
Metadata returns the metadata assocated with the Pipelines (name and labels).
func (*Pipeline) PhaseByName ¶
PhaseByName returns the Phase (if it exists) with a matching name.
func (*Pipeline) Phases ¶
func (p *Pipeline) Phases(opts ...containers.Option[PhaseOptions]) iter.Seq[Phase]
Phases lists all phases in the pipeline with optional predicates.
type Resource ¶
Resource is an instance of a resource in a phase. Primarilly, it exposes a Digest method used to produce a hash digest of the resource instances current state.
type ResourceWithAnnotations ¶
ResourceWithAnnotations is a resource with additional annotations
type Result ¶
Result is a type that carries annotations relating to the result of calling Perform on an edge.
type RollbackPhase ¶
type RollbackPhase interface {
Phase
// Rollback performs a rollback operation to a previous state identified
// by a version uuid.
Rollback(context.Context, uuid.UUID) (*Result, error)
}
RollbackPhase is a phase which can be rolled back to a previous version.
type State ¶
type State struct {
Version uuid.UUID `json:"version,omitempty"`
Resource Resource `json:"resource,omitempty"`
Digest string `json:"digest,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
RecordedAt time.Time `json:"recorded_at,omitempty"`
}
State contains a snapshot of a resource version at a point in history
type TriggerableEdge ¶
TriggerableEdge is an edge that has an additional method RunTriggers. This method should schedule any necessary dependencies needed to automate calling perform on the respectibe edge (e.g. start background schedules).