graph

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 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

Overview

Package graph is the lineage graph strata renders: nodes for images, external roots and phantom ancestors, edges with their provenance, and the budget rules that keep a descendant tree of a popular base readable.

Index

Constants

View Source
const (
	KindImage     = "image"
	KindExternal  = "external"
	KindPhantom   = "phantom"
	KindCollapsed = "collapsed"
	KindOverflow  = "overflow"
)

Node kinds.

View Source
const (
	Ancestry    = "ancestry"
	Descendants = "descendants"
	Query       = "query"
)

Graph kinds.

View Source
const DefaultBudget = 500

DefaultBudget is the node budget for rendered graphs.

View Source
const MaxBudget = 20000

MaxBudget is the hard cap on --budget, which keeps HTML output openable.

Variables

This section is empty.

Functions

func Label

func Label(repo, digest string, tagRefs []string) string

Label picks the most readable name for an image: its first tag ref that is not latest, then latest, then repo@short digest.

func ShortDigest

func ShortDigest(d string) string

ShortDigest abbreviates sha256:<hex> to sha256:<first 12 hex>.

Types

type Edge

type Edge struct {
	Parent     string `json:"parent"`
	Child      string `json:"child"`
	Source     string `json:"source"`
	Confidence string `json:"confidence,omitempty"`
	Conflict   bool   `json:"conflict,omitempty"`
}

Edge links a parent to a child.

type Graph

type Graph struct {
	Kind   string `json:"kind"`
	Root   string `json:"root,omitempty"`
	Title  string `json:"title"`
	Nodes  []Node `json:"nodes"`
	Edges  []Edge `json:"edges"`
	Hidden int    `json:"hidden,omitempty"`
}

Graph is a set of nodes and edges of one kind.

func (*Graph) Budget

func (g *Graph) Budget(budget int, keep ...string)

Budget keeps a graph within a node budget. Children of one parent that share a repo collapse into one node first; if the graph is still too big, the deepest nodes are cut and each parent that lost children gets a "+N more" node. Nodes listed in keep are never collapsed or cut.

func (*Graph) Children

func (g *Graph) Children() map[string][]string

Children returns each node's distinct children, sorted by label then ID, with overflow nodes last.

func (*Graph) Node

func (g *Graph) Node(id string) *Node

Node returns the node with an ID, or nil.

type Node

type Node struct {
	ID      string   `json:"id"`
	Label   string   `json:"label"`
	Repo    string   `json:"repo,omitempty"`
	Refs    []string `json:"refs,omitempty"`
	Kind    string   `json:"kind"`
	Verdict string   `json:"verdict,omitempty"`
	Reasons []string `json:"reasons,omitempty"`
	// Note is a compact summary of the staleness signals, such as
	// "base drift: 3 gens".
	Note     string   `json:"note,omitempty"`
	Created  string   `json:"created,omitempty"`
	Size     int64    `json:"size,omitempty"`
	Layers   int      `json:"layers,omitempty"`
	Depth    int      `json:"depth"`
	Matched  bool     `json:"matched,omitempty"`
	Count    int      `json:"count,omitempty"`
	Members  []string `json:"members,omitempty"`
	Platform string   `json:"platform,omitempty"`
}

Node is one vertex.

Jump to

Keyboard shortcuts

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