yamlgraph

package
v0.0.0-...-427e46a Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2017 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package yamlgraph provides the facilities for loading a graph from a yaml file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	Name string `yaml:"name"`
	From Vertex `yaml:"from"`
	To   Vertex `yaml:"to"`
}

Edge is the data structure of an edge.

type GAPI

type GAPI struct {
	File *string // yaml graph definition to use; nil if undefined
	// contains filtered or unexported fields
}

GAPI implements the main yamlgraph GAPI interface.

func NewGAPI

func NewGAPI(data gapi.Data, file *string) (*GAPI, error)

NewGAPI creates a new yamlgraph GAPI struct and calls Init().

func (*GAPI) Close

func (obj *GAPI) Close() error

Close shuts down the yamlgraph GAPI.

func (*GAPI) Graph

func (obj *GAPI) Graph() (*pgraph.Graph, error)

Graph returns a current Graph.

func (*GAPI) Init

func (obj *GAPI) Init(data gapi.Data) error

Init initializes the yamlgraph GAPI struct.

func (*GAPI) Next

func (obj *GAPI) Next() chan error

Next returns nil errors every time there could be a new graph.

type GraphConfig

type GraphConfig struct {
	Graph     string               `yaml:"graph"`
	Resources Resources            `yaml:"resources"`
	Collector []collectorResConfig `yaml:"collect"`
	Edges     []Edge               `yaml:"edges"`
	Comment   string               `yaml:"comment"`
	Remote    string               `yaml:"remote"`
}

GraphConfig is the data structure that describes a single graph to run.

func ParseConfigFromFile

func ParseConfigFromFile(filename string) *GraphConfig

ParseConfigFromFile takes a filename and returns the graph config structure.

func (*GraphConfig) NewGraphFromConfig

func (c *GraphConfig) NewGraphFromConfig(hostname string, world gapi.World, noop bool) (*pgraph.Graph, error)

NewGraphFromConfig transforms a GraphConfig struct into a new graph. FIXME: remove any possibly left over, now obsolete graph diff code from here!

func (*GraphConfig) Parse

func (c *GraphConfig) Parse(data []byte) error

Parse parses a data stream into the graph structure.

type Resources

type Resources struct {
	// in alphabetical order
	Exec     []*resources.ExecRes     `yaml:"exec"`
	File     []*resources.FileRes     `yaml:"file"`
	Hostname []*resources.HostnameRes `yaml:"hostname"`
	Msg      []*resources.MsgRes      `yaml:"msg"`
	Noop     []*resources.NoopRes     `yaml:"noop"`
	Nspawn   []*resources.NspawnRes   `yaml:"nspawn"`
	Password []*resources.PasswordRes `yaml:"password"`
	Pkg      []*resources.PkgRes      `yaml:"pkg"`
	Svc      []*resources.SvcRes      `yaml:"svc"`
	Timer    []*resources.TimerRes    `yaml:"timer"`
	Virt     []*resources.VirtRes     `yaml:"virt"`
}

Resources is the data structure of the set of resources.

type Vertex

type Vertex struct {
	Kind string `yaml:"kind"`
	Name string `yaml:"name"`
}

Vertex is the data structure of a vertex.

Jump to

Keyboard shortcuts

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