Documentation
¶
Overview ¶
Package wave computes parallel execution waves from a dependency graph of ticks using Kahn's algorithm (topological sort by levels).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Waves []Wave
CycleIDs []string // non-empty when a circular dependency is detected
}
Result holds the computed waves and any cycle information.
func Compute ¶
Compute returns the waves for a set of tasks using Kahn's algorithm. Only includes tasks that are open (not closed) and not awaiting human action. Tasks are grouped into waves based on their BlockedBy dependencies. Within each wave, tasks are sorted by priority (ascending), then by ID.
If allTicks is provided, it is used to look up the status of blockers that are outside the task set (mirroring query.Ready semantics): an open external blocker keeps its dependents out of wave 1 — it acts as a virtual wave-1 node, so dependents land in wave 2 or later. Missing blockers are treated as closed (handles orphaned references). Without allTicks, blockers outside the task set are ignored entirely (legacy behavior).
Note that wave 1 may be absent when no task is unblocked: wave numbers reflect rounds-until-ready, so the first emitted wave can be Number 2.