graph

package
v0.18.8 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package graph provides a graph or interconnected state-machines and their states, based on the dbg telemetry protocol.

Index

Constants

This section is empty.

Variables

View Source
var ErrGraph = errors.New("graph error")

Functions

func AddErrGraph added in v0.18.8

func AddErrGraph(
	event *am.Event, mach *am.Machine, err error, args ...am.A,
) am.Result

AddErrGraph adds ErrGraph.

func Markdown added in v0.18.6

func Markdown(inspect map[string]*MachInspect) string

Types

type Client

type Client struct {
	Id string
	// TODO version schemas
	MsgSchema *dbg.DbgMsgStruct

	LatestMsgTx   *dbg.DbgMsgTx
	LatestTimeSum uint64
	LatestClock   am.Time
	ConnId        string
}

Client represents a single state machine withing the network graph.

type Connection

type Connection struct {
	Edge   *EdgeData
	Source *Vertex
	Target *Vertex
}

type Edge

type Edge = graph.Edge[*Vertex]

type EdgeData

type EdgeData struct {
	// machine has a state
	MachHas *MachineHas
	// machine has an RPC connection to another machine
	MachConnectedTo bool
	// machine is a child of another machine
	MachChildOf bool
	// machine has pipes going to another machine
	MachPipesTo []*MachPipeTo

	// state has relations with other states
	StateRelation []*StateRelation
}

type Graph

type Graph struct {
	Server  *am.Machine
	Clients map[string]*Client

	// G is a directed graph of machines and states with metadata.
	G graph.Graph[string, *Vertex]
	// Map is a unidirectional mirror of g, without metadata.
	Map graph.Graph[string, *Vertex]
}

func New

func New(server *am.Machine) (*Graph, error)

func (*Graph) AddClient

func (g *Graph) AddClient(msg *dbg.DbgMsgStruct) error

func (*Graph) Clear

func (g *Graph) Clear()

func (*Graph) Clone

func (g *Graph) Clone() (*Graph, error)

Clone returns a deep clone of the graph.

func (*Graph) Connection

func (g *Graph) Connection(source, target string) (*Connection, error)

Connection returns a Connection for the given source-target.

func (*Graph) DumpGv added in v0.18.1

func (g *Graph) DumpGv(path string) error

DumpGv will create a dot-format *.gv file of the graph. To create an SVG:

dot -Tsvg -O path

func (*Graph) Inspect added in v0.18.6

func (g *Graph) Inspect() (map[string]*MachInspect, error)

func (*Graph) ParseMsg

func (g *Graph) ParseMsg(id string, msgTx *dbg.DbgMsgTx)

func (*Graph) RemoveClient

func (g *Graph) RemoveClient(id string) error

type MachInspect added in v0.18.6

type MachInspect struct {
	Child  string
	States []string
	Conns  []string
	Pipes  map[string][]string
}

type MachPipeTo

type MachPipeTo struct {
	FromState string
	ToState   string
	MutType   am.MutationType
}

TODO use am.Pipe

type MachineHas

type MachineHas struct {
	Inherited string
	Auto      bool
	Multi     bool
}

type StateRelation

type StateRelation struct {
	RelType am.Relation
}

type Vertex

type Vertex struct {
	StateName string
	MachId    string
}

Jump to

Keyboard shortcuts

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