ir

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 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 ir defines the immutable, language-neutral graph representation consumed by runtime and inspection tooling. Authoring frontends must lower through the shared graph compiler rather than constructing runtime objects.

Index

Constants

View Source
const BoundaryQueuePrefix = "boundary:"

BoundaryQueuePrefix reserves the runtime/inspection queue namespace used for exported graph boundaries. Internal edge IDs may never use it; without this reservation an edge could alias a boundary queue in live evidence.

View Source
const FormatVersion = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Boundary

type Boundary struct {
	Name      string            `json:"name" yaml:"name"`
	Direction BoundaryDirection `json:"direction" yaml:"direction"`
	Endpoint  Endpoint          `json:"endpoint" yaml:"endpoint"`
	Type      element.Type      `json:"type" yaml:"type"`
	Source    *Source           `json:"source,omitempty" yaml:"source,omitempty"`
}

Boundary exports an internal lane as part of the composite contract.

type BoundaryDirection

type BoundaryDirection string

BoundaryDirection is relative to the composite graph.

const (
	InputBoundary  BoundaryDirection = "input"
	OutputBoundary BoundaryDirection = "output"
)

type Delivery

type Delivery string

Delivery is the bounded-channel behavior when a queue is full.

const (
	Lossless Delivery = "lossless"
	Lossy    Delivery = "lossy"
)

type Edge

type Edge struct {
	ID       string       `json:"id" yaml:"id"`
	From     Endpoint     `json:"from" yaml:"from"`
	To       Endpoint     `json:"to" yaml:"to"`
	Type     element.Type `json:"type" yaml:"type"`
	Delivery Delivery     `json:"delivery" yaml:"delivery"`
	Ordering string       `json:"ordering" yaml:"ordering"`
	Depth    int          `json:"depth" yaml:"depth"`
	Source   *Source      `json:"source,omitempty" yaml:"source,omitempty"`
}

Edge is one bounded, typed channel.

type Endpoint

type Endpoint struct {
	Node string `json:"node" yaml:"node"`
	Port string `json:"port" yaml:"port"`
	Lane string `json:"lane,omitempty" yaml:"lane,omitempty"`
}

Endpoint identifies a concrete port lane. Lane is empty for a singular port.

func (Endpoint) String

func (endpoint Endpoint) String() string

type Graph

type Graph struct {
	FormatVersion uint64     `json:"format_version" yaml:"format_version"`
	ID            string     `json:"id" yaml:"id"`
	Revision      uint64     `json:"revision" yaml:"revision"`
	Fingerprint   string     `json:"fingerprint" yaml:"fingerprint"`
	Lineage       []string   `json:"lineage,omitempty" yaml:"lineage,omitempty"`
	Nodes         []Node     `json:"nodes" yaml:"nodes"`
	Edges         []Edge     `json:"edges,omitempty" yaml:"edges,omitempty"`
	Boundaries    []Boundary `json:"boundaries,omitempty" yaml:"boundaries,omitempty"`
	Scopes        []Scope    `json:"scopes,omitempty" yaml:"scopes,omitempty"`
}

Graph is a fully elaborated graph. Slices are canonicalized by Freeze; code mounting a graph should accept only values for which Validate succeeds.

func Freeze

func Freeze(graph Graph) (Graph, error)

Freeze recursively clones, canonicalizes, validates, and fingerprints a graph. The input is never mutated.

func Parse

func Parse(source []byte) (Graph, error)

Parse decodes strict JSON and verifies its fingerprint.

func (Graph) Marshal

func (graph Graph) Marshal() ([]byte, error)

Marshal returns deterministic, newline-terminated JSON.

func (Graph) Validate

func (graph Graph) Validate() error

Validate proves structural consistency and verifies the stored fingerprint.

type Node

type Node struct {
	ID                  string                             `json:"id" yaml:"id"`
	Element             element.Identity                   `json:"element" yaml:"element"`
	Implementation      string                             `json:"implementation,omitempty" yaml:"implementation,omitempty"`
	ConfigReference     string                             `json:"config_reference,omitempty" yaml:"config_reference,omitempty"`
	ConfigDigest        string                             `json:"config_digest,omitempty" yaml:"config_digest,omitempty"`
	DeploymentReference string                             `json:"deployment_reference,omitempty" yaml:"deployment_reference,omitempty"`
	DeploymentDigest    string                             `json:"deployment_digest,omitempty" yaml:"deployment_digest,omitempty"`
	Ports               []Port                             `json:"ports" yaml:"ports"`
	Reaction            element.Reaction                   `json:"reaction,omitempty" yaml:"reaction,omitempty"`
	StateSchema         string                             `json:"state_schema,omitempty" yaml:"state_schema,omitempty"`
	StateTransfer       *element.StateTransferCapabilities `json:"state_transfer,omitempty" yaml:"state_transfer,omitempty"`
	ConfigSchema        string                             `json:"config_schema,omitempty" yaml:"config_schema,omitempty"`
	Dependencies        []element.Dependency               `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
	Effects             []element.Effect                   `json:"effects,omitempty" yaml:"effects,omitempty"`
	Source              *Source                            `json:"source,omitempty" yaml:"source,omitempty"`
}

Node is one resolved element instance. Configuration and implementation references are non-secret identities; actual values live in separate artifacts and are schema-checked before mount.

type Port

type Port struct {
	Name           string              `json:"name" yaml:"name"`
	Direction      element.Direction   `json:"direction" yaml:"direction"`
	Type           element.Type        `json:"type" yaml:"type"`
	Cardinality    element.Cardinality `json:"cardinality" yaml:"cardinality"`
	Required       bool                `json:"required,omitempty" yaml:"required,omitempty"`
	MinConnections int                 `json:"min_connections,omitempty" yaml:"min_connections,omitempty"`
	LossAllowed    bool                `json:"loss_allowed,omitempty" yaml:"loss_allowed,omitempty"`
	DefaultDepth   int                 `json:"default_depth,omitempty" yaml:"default_depth,omitempty"`
	Lanes          []string            `json:"lanes,omitempty" yaml:"lanes,omitempty"`
}

Port is a resolved descriptor port group. A variadic port has one stable lane per edge or exported boundary; lane identities derive from semantic connection identities rather than author-facing numeric indexes.

type Scope

type Scope struct {
	ID         string           `json:"id" yaml:"id"`
	Parent     string           `json:"parent,omitempty" yaml:"parent,omitempty"`
	Composite  element.Identity `json:"composite" yaml:"composite"`
	Nodes      []string         `json:"nodes" yaml:"nodes"`
	Boundaries []ScopeBoundary  `json:"boundaries,omitempty" yaml:"boundaries,omitempty"`
}

Scope retains one expanded subgraph instance so inspection can collapse or expand hierarchy while runtime execution uses the same flattened channels.

type ScopeBoundary

type ScopeBoundary struct {
	Name      string            `json:"name" yaml:"name"`
	Direction BoundaryDirection `json:"direction" yaml:"direction"`
	Endpoint  Endpoint          `json:"endpoint" yaml:"endpoint"`
	Type      element.Type      `json:"type" yaml:"type"`
}

type Source

type Source struct {
	Path        string `json:"path,omitempty" yaml:"path,omitempty"`
	StartOffset int    `json:"start_offset,omitempty" yaml:"start_offset,omitempty"`
	EndOffset   int    `json:"end_offset,omitempty" yaml:"end_offset,omitempty"`
	Line        int    `json:"line,omitempty" yaml:"line,omitempty"`
	Column      int    `json:"column,omitempty" yaml:"column,omitempty"`
}

Source identifies a frontend location for inspection and diagnostics. It is provenance rather than graph semantics and is excluded from fingerprints.

Jump to

Keyboard shortcuts

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