dependency

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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]) Reverse

func (graph *Graph[K, N]) Reverse() (*Graph[K, 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 GraphDependency

type GraphDependency[K comparable] [2]K

func (GraphDependency[K]) Dependant

func (dep GraphDependency[K]) Dependant() K

func (GraphDependency[K]) Dependency

func (dep GraphDependency[K]) Dependency() K

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 constants.

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