dag

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddOption

type AddOption func(*AddOpts)

func Dependencies

func Dependencies(deps []string) AddOption

func Labels

func Labels(labels []string) AddOption

type AddOpts

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

type Cycle

type Cycle struct {
	Path []string
}

Cycle is not a loop :) See https://math.stackexchange.com/questions/1490053

func (*Cycle) String

func (n *Cycle) String() string

type DAG

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

func New

func New(opt ...Option) *DAG

func (*DAG) Add

func (g *DAG) Add(node string, opt ...AddOption) bool

func (*DAG) AddDependencies

func (g *DAG) AddDependencies(sub string, dependencies []string) bool

func (*DAG) AddDependency

func (g *DAG) AddDependency(sub string, dependencies ...string) bool

func (*DAG) AddEdge

func (g *DAG) AddEdge(from, to string) bool

func (*DAG) AddLabel

func (g *DAG) AddLabel(sub string, labels ...string)

func (*DAG) AddLabels

func (g *DAG) AddLabels(sub string, labels []string)

func (*DAG) AddNode

func (g *DAG) AddNode(name string) bool

func (*DAG) AddNodes

func (g *DAG) AddNodes(names ...string) bool

func (*DAG) Plan

func (g *DAG) Plan(opts ...SortOption) (Topology, error)

func (*DAG) RemoveEdge

func (g *DAG) RemoveEdge(from, to string) bool

func (*DAG) Sort

func (g *DAG) Sort(opts ...SortOption) (Topology, error)

Sort topologically sorts the nodes while grouping nodes at the same "depth" into a same group

func (*DAG) WriteDotTo

func (d *DAG) WriteDotTo(w io.Writer) error

type Error

type Error struct {
	Cycle *Cycle
}

func (*Error) Error

func (e *Error) Error() string

type NodeInfo

type NodeInfo struct {
	Id        string
	ParentIds []string
	ChildIds  []string
}

func (*NodeInfo) String

func (n *NodeInfo) String() string

type Option

type Option func(*DAG)

func Capacity

func Capacity(n int) Option

func Node

func Node(nodes ...string) Option

func Nodes

func Nodes(nodes []string) Option

type SortOption

type SortOption interface {
	ApplySortOptions(*SortOptions)
}

func Only

func Only(nodes ...string) SortOption

func SortOptionFunc

func SortOptionFunc(f func(so *SortOptions)) SortOption

func WithDependencies

func WithDependencies() SortOption

func WithoutDependencies

func WithoutDependencies() SortOption

type SortOptions

type SortOptions struct {
	Only []string

	WithDependencies bool

	WithoutDependencies bool
}

func (SortOptions) ApplySortOptions

func (so SortOptions) ApplySortOptions(dst *SortOptions)

type Topology

type Topology [][]*NodeInfo

func (Topology) String

func (r Topology) String() string

type UnhandledDependency

type UnhandledDependency struct {
	Id         string
	Dependents []string
}

type UnhandledDependencyError

type UnhandledDependencyError struct {
	UnhandledDependencies []UnhandledDependency
}

func (*UnhandledDependencyError) Error

func (e *UnhandledDependencyError) Error() string

Jump to

Keyboard shortcuts

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