helpers

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package helpers provides graph traversal utilities for the Provenance blocked-by dependency graph. These functions perform DFS over the dominikbraun/graph structure and resolve traversed IDs to full Task values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ancestors

func Ancestors(g dgraph.Graph[string, ptypes.Task], db TaskGetter, id ptypes.TaskID) ([]ptypes.Task, error)

Ancestors returns all tasks that transitively block the given task. In the blocked-by graph, A->B means "A is blocked by B". Ancestors of A are B and everything B transitively waits for (outgoing adjacency DFS). The given task itself is never included. Returns an empty slice if none.

func Descendants

func Descendants(g dgraph.Graph[string, ptypes.Task], db TaskGetter, id ptypes.TaskID) ([]ptypes.Task, error)

Descendants returns all tasks that are transitively waiting for the given task to complete. In the blocked-by graph, A->B means "A is blocked by B". Descendants of B are A and everything that transitively depends on A (predecessor DFS). The given task itself is never included. Returns an empty slice if none.

Types

type TaskGetter

type TaskGetter interface {
	GetTask(id ptypes.TaskID) (ptypes.Task, bool, error)
}

TaskGetter is the minimal interface needed by graph traversal helpers. It allows looking up a single task by ID without coupling to the concrete sqlite.DB type, making helpers independently testable with mocks.

Jump to

Keyboard shortcuts

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