core

package
v0.0.1-prerelease4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)

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 IsPhase

func IsPhase(p Phase) containers.Option[PhaseOptions]

IsPhase causes a call to Phases to list specifically the provided phase p.

func PromotesFrom

func PromotesFrom[R Resource](c ResourcePhase[R]) containers.Option[AddPhaseOptions[R]]

PromotesFrom configures a dependent Phase to promote from for the Phase being added.

Types

type AddPhaseOptions

type AddPhaseOptions[R Resource] struct {
	PromotedFrom ResourcePhase[R]
}

AddPhaseOptions are used to configure the addition of a ResourcePhase to a Pipeline

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 {
	Metadata() Metadata
	Source() Metadata
	Get(context.Context) (Resource, error)
	Promote(context.Context) 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

type Pipeline

type Pipeline interface {
	Metadata() Metadata
	PhaseByName(string) (Phase, error)
	Phases(...containers.Option[PhaseOptions]) iter.Seq[Phase]
	Dependencies() map[Phase]Phase
}

Pipeline is a collection of phases with potential promotion dependencies relationships between one another.

type Resource

type Resource interface {
	Digest() (string, error)
}

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 ResourcePhase

type ResourcePhase[R Resource] interface {
	Phase
	GetResource(context.Context) (R, error)
}

ResourcePhase is a Phase bound to a particular resource type R.

Jump to

Keyboard shortcuts

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