manager

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InDependencyOrder

func InDependencyOrder(ctx context.Context, apps map[string]*interface{}, fn func(context.Context, string) error) error

InDependencyOrder applies the function to the apps of the project taking in account the dependency order

func InReversDependencyOrder

func InReversDependencyOrder(ctx context.Context, apps map[string]*interface{}, fn func(context.Context, string) error) error

InReverseDependencyOrder applies the function to the apps of the project in reverse order of dependencies

Types

type AppStatus

type AppStatus int

AppStatus indicates the status of a app

const (
	AppStopped AppStatus = iota
	AppStarted
)

Apps status flags

type Graph

type Graph struct {
	Vertices map[string]*Vertex
	// contains filtered or unexported fields
}

Graph represents project as app dependencies

func NewGraph

func NewGraph(apps map[string]*interface{}, initialStatus AppStatus) *Graph

NewGraph returns the dependency graph of the apps

func (*Graph) AddEdge

func (g *Graph) AddEdge(source string, destination string) error

func (*Graph) AddVertex

func (g *Graph) AddVertex(key string, app string, initialStatus AppStatus)

func (*Graph) FilterChildren

func (g *Graph) FilterChildren(key string, status AppStatus) []*Vertex

FilterChildren returns children of a certain vertex that are in a certain status

func (*Graph) FilterParents

func (g *Graph) FilterParents(key string, status AppStatus) []*Vertex

FilterParents returns the parents of a certain vertex that are in a certain status

func (*Graph) HasCycles

func (g *Graph) HasCycles() (bool, error)

HasCycles detects cycles in the graph

func (*Graph) Leaves

func (g *Graph) Leaves() []*Vertex

Leaves returns the slice of leaves of the graph

func (*Graph) Roots

func (g *Graph) Roots() []*Vertex

Roots returns the slice of "Roots" of the graph

func (*Graph) UpdateStatus

func (g *Graph) UpdateStatus(key string, status AppStatus)

UpdateStatus updates the status of a certain vertex

type Manager

type Manager interface {
	Deploy(ui terminal.UI) error
	Destroy(ui terminal.UI, autoApprove bool) error
	Build(ui terminal.UI) error
	Push(ui terminal.UI) error
	Redeploy(ui terminal.UI) error
	Explain() error
}

type Vertex

type Vertex struct {
	Key      string
	App      string
	Status   AppStatus
	Children map[string]*Vertex
	Parents  map[string]*Vertex
}

Vertex represents a app in the dependencies structure

func NewVertex

func NewVertex(key string, app string, initialStatus AppStatus) *Vertex

func (*Vertex) GetChildren

func (v *Vertex) GetChildren() []*Vertex

GetChildren returns a slice with the child vertexes of the a Vertex

func (*Vertex) GetParents

func (v *Vertex) GetParents() []*Vertex

GetParents returns a slice with the parent vertexes of the a Vertex

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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