Documentation
¶
Overview ¶
Package pdag provides facilities for constructing a DAG and the traversing it efficiently in parallel.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DAG ¶
type DAG[T any] struct { // contains filtered or unexported fields }
func (*DAG[T]) Drain ¶ added in v3.211.0
Drain nodes from the dag. Nodes will always come after their dependents.
Any returned Done func **must** be called. Failing to do so may cause other iterators to block indefinitely or leak memory.
The returned iterator may be called in parallel. When called in parallel, the iterator may block when no nodes are available. The returned iterator will not return until the entire graph has been walked.
Drain will stop the iterator when the passed in ctx is canceled. If the caller is concerned about the context being canceled, they **must** check ctx.Err() to determine if Drain finished.
func (*DAG[T]) NewEdge ¶
NewEdge creates a new edge FROM -> TO, ensuring that FROM comes before TO in a traversal of g.
type ErrorCycle ¶
type ErrorCycle[T any] struct { Cycle []T }
func (ErrorCycle[T]) Error ¶
func (err ErrorCycle[T]) Error() string
type ErrorReentrant ¶ added in v3.211.0
type ErrorReentrant struct{}
ErrorReentrant indicates that [NewEdge] attempted to create a "from->to" connection where "to" was already walked (or currently being walked) and "from" was not yet walked (or currently is being walked). This would violate the [DAG]s traversal guarantees, since it guarantees that nodes will only be seen after all of their from edges have been seen.
func (ErrorReentrant) Error ¶ added in v3.211.0
func (err ErrorReentrant) Error() string
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a reference to a node in a DAG.
The only way to create a Node is with DAG.NewNode, and the Node is only valid in the context of the graph it was created in.
type WalkOption ¶
type WalkOption interface {
// contains filtered or unexported methods
}
func MaxProcs ¶
func MaxProcs(i int) WalkOption
MaxProcs limits the number of concurrent work threads in a DAG.Walk call.
i is ignored if it is less then 1.