dependency

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph[K comparable, N any] struct {
	Nodes map[K]*Node[N]
	// contains filtered or unexported fields
}

Graph is dependencies graph. K stands for map keys type (e.g. string names), N for data type.

func NewGraph

func NewGraph[K comparable, N any]() *Graph[K, N]

NewGraph returns empty graph.

func (*Graph[K, N]) AddDependency

func (graph *Graph[K, N]) AddDependency(dependant, dependency K)

AddDependency adds lazy dependency. It will be evaluated only in `Build` method.

func (*Graph[K, N]) Build

func (graph *Graph[K, N]) Build() error

func (*Graph[K, N]) NewNode

func (graph *Graph[K, N]) NewNode(key K, data N) error

func (*Graph[K, N]) Run

func (graph *Graph[K, N]) Run() <-chan *Node[N]

Run returns channel for data and runs goroutine that handles dependency graph and populates channel with ready to install releases.

type Node

type Node[N any] struct {
	Data N
	// contains filtered or unexported fields
}

Node is graph node. N stands for data type.

func (*Node[N]) IsDone

func (node *Node[N]) IsDone() bool

func (*Node[N]) IsFailed

func (node *Node[N]) IsFailed() bool

func (*Node[N]) IsReady

func (node *Node[N]) IsReady() bool

func (*Node[N]) SetFailed

func (node *Node[N]) SetFailed()

func (*Node[N]) SetSucceeded

func (node *Node[N]) SetSucceeded()

type NodeStatus

type NodeStatus int

NodeStatus is used to code release status - success or failed. Please use ReleaseSuccess and ReleaseFailed contants.

const (
	// NodePending is a NodeStatus for pending node.
	NodePending NodeStatus = iota

	// NodeSuccess is a NodeStatus for success node.
	NodeSuccess

	// NodeFailed is a NodeStatus for failed node.
	NodeFailed
)

Jump to

Keyboard shortcuts

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