waitfor

package
v0.0.0-...-51a0f74 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelpDisplay

func HelpDisplay(err error, input string, idents []string) error

func NewWaitForCommand

func NewWaitForCommand() cmd.Command

NewWaitForCommand creates the wait-for supercommand and registers the subcommands that it supports.

Types

type ApplicationScope

type ApplicationScope struct {
	ApplicationInfo *params.ApplicationInfo
	UnitInfos       map[string]*params.UnitInfo
	MachineInfos    map[string]*params.MachineInfo
	// contains filtered or unexported fields
}

ApplicationScope allows the query to introspect a application entity.

func MakeApplicationScope

func MakeApplicationScope(ctx ScopeContext,
	appInfo *params.ApplicationInfo,
	unitInfos map[string]*params.UnitInfo,
	machineInfos map[string]*params.MachineInfo,
) ApplicationScope

MakeApplicationScope creates an ApplicationScope from an ApplicationInfo

func (ApplicationScope) GetIdentValue

func (m ApplicationScope) GetIdentValue(name string) (query.Box, error)

GetIdentValue returns the value of the identifier in a given scope.

func (ApplicationScope) GetIdents

func (m ApplicationScope) GetIdents() []string

GetIdents returns the identifiers with in a given scope.

type Callback

type Callback = func(EventType)

Callback represents a way to subscribe to a given event and be called for all events and up to the implementation to filter for a given event.

type EventType

type EventType int

EventType represents what type of event is being passed.

const (
	// WatchAllStarted defines if a watcher has started.
	WatchAllStarted EventType = iota
)

type GenericScope

type GenericScope struct {
	// contains filtered or unexported fields
}

GenericScope allows the query to introspect an entity.

func (*GenericScope) Clone

func (m *GenericScope) Clone() query.Scope

Clone a given scope.

func (*GenericScope) GetIdentValue

func (m *GenericScope) GetIdentValue(name string) (query.Box, error)

GetIdentValue returns the value of the identifier in a given scope.

func (*GenericScope) GetIdents

func (m *GenericScope) GetIdents() []string

GetIdents returns the names of all the available idents.

func (*GenericScope) SetIdentValue

func (m *GenericScope) SetIdentValue(name string, value any)

SetIdentValue sets a new ident and it's value on a given scope.

type Logger

type Logger interface {
	Infof(string, ...any)
	Verbosef(string, ...any)
}

Logger is the interface used by the wait-for command to log messages.

type MachineScope

type MachineScope struct {
	MachineInfo *params.MachineInfo
	// contains filtered or unexported fields
}

MachineScope allows the query to introspect a model entity.

func MakeMachineScope

func MakeMachineScope(ctx ScopeContext, info *params.MachineInfo) MachineScope

MakeMachineScope creates an MachineScope from an MachineInfo

func (MachineScope) GetIdentValue

func (m MachineScope) GetIdentValue(name string) (query.Box, error)

GetIdentValue returns the value of the identifier in a given scope.

func (MachineScope) GetIdents

func (m MachineScope) GetIdents() []string

GetIdents returns the identifiers with in a given scope.

type ModelScope

type ModelScope struct {
	ModelInfo        *params.ModelUpdate
	ApplicationInfos map[string]*params.ApplicationInfo
	UnitInfos        map[string]*params.UnitInfo
	MachineInfos     map[string]*params.MachineInfo
	// contains filtered or unexported fields
}

ModelScope allows the query to introspect a model entity.

func MakeModelScope

func MakeModelScope(ctx ScopeContext,
	modelInfo *params.ModelUpdate,
	applicationInfos map[string]*params.ApplicationInfo,
	unitInfos map[string]*params.UnitInfo,
	machineInfos map[string]*params.MachineInfo,
) ModelScope

MakeModelScope creates a ModelScope from a ModelUpdate

func (ModelScope) GetIdentValue

func (m ModelScope) GetIdentValue(name string) (query.Box, error)

GetIdentValue returns the value of the identifier in a given scope.

func (ModelScope) GetIdents

func (m ModelScope) GetIdents() []string

GetIdents returns the identifiers with in a given scope.

type ScopeContext

type ScopeContext struct {
	// contains filtered or unexported fields
}

ScopeContext defines a context for a given scope.

func MakeScopeContext

func MakeScopeContext() ScopeContext

func (ScopeContext) Child

func (c ScopeContext) Child(entityName, name string) ScopeContext

Child creates a child context of all idents for a given context.

func (ScopeContext) RecordIdent

func (c ScopeContext) RecordIdent(ident string)

RecordIdent records the witnessing of a ident.

func (ScopeContext) RecordedIdents

func (c ScopeContext) RecordedIdents() []string

RecordedIdents returns the witnessed idents via a scoped context.

type ScopedBox

type ScopedBox struct {
	// contains filtered or unexported fields
}

ScopedBox defines a scoped box of scopes. Lifts any scope into a box to be used later on.

func NewScopedBox

func NewScopedBox(scopes map[string]query.Scope) *ScopedBox

NewScopedBox creates a new Box value

func (*ScopedBox) Equal

func (o *ScopedBox) Equal(other query.Ord) bool

Equal checks if an ScopedBox is equal to another ScopedBox.

func (*ScopedBox) ForEach

func (o *ScopedBox) ForEach(fn func(any) bool)

ForEach iterates over each value in the box.

func (*ScopedBox) IsZero

func (o *ScopedBox) IsZero() bool

IsZero returns if the underlying value is zero.

func (*ScopedBox) Less

func (o *ScopedBox) Less(other query.Ord) bool

Less checks if a ScopedBox is less than another ScopedBox.

func (*ScopedBox) Value

func (o *ScopedBox) Value() any

Value defines the shadow type value of the Box.

type Strategy

type Strategy struct {
	ClientFn func() (api.WatchAllAPI, error)
	Timeout  time.Duration
	// contains filtered or unexported fields
}

Strategy defines a series of instructions to run for a given wait for plan.

func (*Strategy) Run

func (s *Strategy) Run(
	ctx context.Context,
	name string, input string,
	runFn StrategyFunc,
	notifyFn func(lastError error, attempt int),
) error

Run the strategy and return the given result set.

func (*Strategy) Subscribe

func (s *Strategy) Subscribe(sub Callback)

Subscribe a subscriber to an events coming out of the strategy.

type StrategyFunc

type StrategyFunc func(string, []params.Delta, query.Query) (bool, error)

StrategyFunc defines a way to change the underlying strategy function that can be changed depending on the callee.

type UnitScope

type UnitScope struct {
	UnitInfo     *params.UnitInfo
	MachineInfos map[string]*params.MachineInfo
	// contains filtered or unexported fields
}

UnitScope allows the query to introspect a unit entity.

func MakeUnitScope

func MakeUnitScope(ctx ScopeContext, info *params.UnitInfo, machineInfos map[string]*params.MachineInfo) UnitScope

MakeUnitScope creates an UnitScope from an UnitInfo

func (UnitScope) GetIdentValue

func (m UnitScope) GetIdentValue(name string) (query.Box, error)

GetIdentValue returns the value of the identifier in a given scope.

func (UnitScope) GetIdents

func (m UnitScope) GetIdents() []string

GetIdents returns the identifiers with in a given scope.

Directories

Path Synopsis
api
Package api exists because we can't generate mocks in the main namespace.
Package api exists because we can't generate mocks in the main namespace.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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