Documentation
¶
Index ¶
- type DependencyManager
- type DependencyNode
- func (d *DependencyNode) AddDepender(dependerStage clabtypes.WaitForStage, depender *DependencyNode, ...) error
- func (d *DependencyNode) Done(ctx context.Context, p clabtypes.WaitForStage)
- func (d *DependencyNode) EnterStage(ctx context.Context, p clabtypes.WaitForStage)
- func (d *DependencyNode) MustWait(state clabtypes.WaitForStage) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DependencyManager ¶
type DependencyManager interface {
// AddNode adds a node to the dependency manager.
AddNode(node clabnodes.Node)
// GetNode gets a dependency node registered with the dependency manager.
GetNode(name string) (*DependencyNode, error)
// CheckAcyclicity checks if dependencies contain cycles.
CheckAcyclicity() error
// String returns a string representation of dependencies recorded with dependency manager.
String() string
// GetNodes returns the DependencyNodes registered with the DependencyManager
GetNodes() map[string]*DependencyNode
}
func NewDependencyManager ¶
func NewDependencyManager() DependencyManager
NewDependencyManager constructor.
type DependencyNode ¶
DependencyNode is the representation of a node in the dependency concept.
func NewDependencyNode ¶
func NewDependencyNode(node clabnodes.Node) *DependencyNode
NewDependencyNode initializes a dependencyNode with the given name.
func (*DependencyNode) AddDepender ¶
func (d *DependencyNode) AddDepender(dependerStage clabtypes.WaitForStage, depender *DependencyNode, stage clabtypes.WaitForStage, ) error
AddDepender adds a depender to the dependencyNode. This will also add the dependee to the depender to increase the waitgroup count for the depender.
func (*DependencyNode) Done ¶
func (d *DependencyNode) Done(ctx context.Context, p clabtypes.WaitForStage)
Done is called by a node that has finished all tasks for the provided stage. The dependent nodes will be "notified" that an additional (if multiple exist) dependency is satisfied.
func (*DependencyNode) EnterStage ¶
func (d *DependencyNode) EnterStage(ctx context.Context, p clabtypes.WaitForStage)
EnterStage is called by a node that is meant to enter the specified stage. The call will be blocked until all dependencies for the node to enter the stage are met, or until the context is cancelled (e.g. on a Ctrl-C), in which case it returns without running the stage execs so the worker can unwind instead of hanging until SIGQUIT.
func (*DependencyNode) MustWait ¶
func (d *DependencyNode) MustWait(state clabtypes.WaitForStage) bool
MustWait returns true if the node needs to wait for the given stage, because dependers do exist.