yamlgraph

package
v0.0.0-...-f342e06 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	// Name is the name of this frontend.
	Name = "yaml"
	// Start is the entry point filename that we use. It is arbitrary.
	Start = "/start.yaml"
)

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"`
	Notify bool   `yaml:"notify"`
}

Edge is the data structure of an edge.

type GAPI

type GAPI struct {
	InputURI string // input URI of file system containing yaml graph to use
	// contains filtered or unexported fields
}

GAPI implements the main yamlgraph GAPI interface.

func (*GAPI) Cli

func (obj *GAPI) Cli(c *cli.Context, fs engine.Fs) (*gapi.Deploy, error)

Cli takes a cli.Context, and returns our GAPI if activated. All arguments should take the prefix of the registered name. On activation, if there are any validation problems, you should return an error. If this was not activated, then you should return a nil GAPI and a nil error.

func (*GAPI) CliFlags

func (obj *GAPI) CliFlags() []cli.Flag

CliFlags returns a list of flags used by this deploy subcommand.

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 gapi.Next

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

type GraphConfig

type GraphConfig struct {
	GraphConfigData
	ResList []engine.Res

	Debug bool
	Logf  func(format string, v ...interface{})
}

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

func NewGraphConfigFromFile

func NewGraphConfigFromFile(data []byte, debug bool, logf func(format string, v ...interface{})) (*GraphConfig, error)

NewGraphConfigFromFile takes data and returns the graph config structure.

func (*GraphConfig) NewGraphFromConfig

func (obj *GraphConfig) NewGraphFromConfig(hostname string, world engine.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 (obj *GraphConfig) Parse(data []byte) error

Parse parses a data stream into the graph structure.

func (*GraphConfig) UnmarshalYAML

func (obj *GraphConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshalls the complete graph.

type GraphConfigData

type GraphConfigData struct {
	Graph     string               `yaml:"graph"`
	Collector []collectorResConfig `yaml:"collect"`
	Edges     []Edge               `yaml:"edges"`
	Comment   string               `yaml:"comment"`
}

GraphConfigData contains the graph data for GraphConfig.

type Resource

type Resource struct {
	ResourceData
	// contains filtered or unexported fields
}

Resource is the object that unmarshalls resources.

func (*Resource) Decode

func (r *Resource) Decode(kind string) (err error)

Decode is the second stage for unmarshaling of resources (knowing their kind).

func (*Resource) UnmarshalYAML

func (r *Resource) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the first stage for unmarshaling of resources.

type ResourceData

type ResourceData struct {
	Name string `yaml:"name"`
}

ResourceData are the parameters for resource format.

type Resources

type Resources struct {
	Resources map[string][]Resource `yaml:"resources"`
}

Resources is the object that unmarshalls list 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