graph

package
v0.1.0-preview.4 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package graph validates exact-type provider dependencies and builds a deterministic dependency-first provider construction order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic struct {
	Position         token.Position
	PhysicalPosition token.Position
	ProviderID       string
	Kind             string
	Message          string
}

Diagnostic is one deterministic source-positioned graph failure.

func (Diagnostic) Error

func (d Diagnostic) Error() string

Error renders a compiler-style diagnostic.

type Edge

type Edge struct {
	ConsumerID       string
	DependencyID     string
	RequiredTypeID   string
	ParameterIndex   int
	ParameterName    string
	DependencyKind   provider.DependencyKind
	CollectionIndex  int
	Position         token.Position
	PhysicalPosition token.Position
	// contains filtered or unexported fields
}

Edge represents one provider parameter resolved to its exact provider.

func (Edge) Consumer

func (e Edge) Consumer() provider.Provider

Consumer returns a defensive copy of the consuming provider record.

func (Edge) Dependency

func (e Edge) Dependency() provider.Provider

Dependency returns a defensive copy of the dependency provider record.

type Node

type Node struct {
	ProviderID string
	// contains filtered or unexported fields
}

Node represents one active bootstrap provider. Provider points at the exact record returned by the catalog used for Build.

func (Node) Provider

func (n Node) Provider() provider.Provider

Provider returns a defensive copy of the exact catalog record represented by the node. Live go/types values still belong to the catalog's compiler run.

type Result

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

Result is the immutable-by-convention graph metadata for one provider catalog.

func Build

func Build(catalog provider.Catalog) Result

Build validates exact provider dependencies from one already validated catalog. It never reloads source, inspects function bodies, or executes a provider. A catalog that already has diagnostics is not graphed.

func (Result) ConstructionOrder

func (r Result) ConstructionOrder() []provider.Provider

ConstructionOrder returns providers in deterministic dependency-first order. It is empty whenever Diagnostics is non-empty.

func (Result) Diagnostics

func (r Result) Diagnostics() []Diagnostic

Diagnostics returns a defensive copy of deterministic graph diagnostics.

func (Result) Edges

func (r Result) Edges() []Edge

Edges returns a defensive copy of parameter edges in stable consumer and parameter order.

func (Result) Nodes

func (r Result) Nodes() []Node

Nodes returns a defensive copy of nodes in stable provider-ID order.

Jump to

Keyboard shortcuts

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