graphjson

package
v0.0.0-...-f0bd5fd Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package graphjson saves and loads architectures to and from graph json files

Index

Constants

This section is empty.

Variables

View Source
var Enabled bool

Enabled is set via command line flags to turn on json logging

Functions

func Close

func Close()

Close completes the json file format and closes the file

func Setup

func Setup(arch string)

Setup by opening the "arch".json file and writing a header, noting the generated architecture type, version and args for the run

func Write

func Write(str string)

Write a string to the file

func WriteDone

func WriteDone(name string, t time.Time)

WriteDone records that a node has gone away normally

func WriteEdge

func WriteEdge(fromTo string, t time.Time)

WriteEdge writes the edge to a file given a space separated from and to node name

func WriteForget

func WriteForget(fromTo string, t time.Time)

WriteForget writes the forgotten edge to a file given a space separated edge id, from and to node names

func WriteNode

func WriteNode(nameService string, t time.Time)

WriteNode writes the node to a file given a space separated name and service type

Types

type DoneV0r4

type DoneV0r4 struct {
	Done   string `json:"done"`
	Exit   string `json:"exit"`
	Tstamp string `json:"timestamp"`
}

DoneV0r4 records a node that goes away, and its exit status. New in 0.4

type EdgeV0r4

type EdgeV0r4 struct {
	Edge   string `json:"edge"`
	Source string `json:"source"`
	Target string `json:"target"`
	Tstamp string `json:"timestamp,omitempty"` // 0.4
}

EdgeV0r4 defines an edge for version 0.4, used to make json edges for writing

type ElementV0r4

type ElementV0r4 struct {
	Node     string `json:"node,omitempty"`
	Package  string `json:"package,omitempty"`
	Service  string `json:"service,omitempty"` // name changed from service 0.3 to package 0.4
	Edge     string `json:"edge,omitempty"`
	Source   string `json:"source,omitempty"`
	Target   string `json:"target,omitempty"`
	Forget   string `json:"forget"`
	Done     string `json:"target,omitempty"`
	Exit     string `json:"exit,omitempty"`
	Metadata string `json:"metadata,omitempty"` // added to 0.4
	Tstamp   string `json:"timestamp,omitempty"`
}

ElementV0r4 defines a way to read either a node, edge or done in the graph for version 0.3 or 0.4

type ForgetV0r4

type ForgetV0r4 struct {
	Forget string `json:"forget"`
	Source string `json:"source"`
	Target string `json:"target"`
	Tstamp string `json:"timestamp"`
}

ForgetV0r4 records an edge that has been forgotten and should be removed, forget id should match previous edge id

type GraphV0r4

type GraphV0r4 struct {
	Arch    string        `json:"arch"`
	Version string        `json:"version"`
	Args    string        `json:"args"`
	Date    string        `json:"date,omitempty"` // 0.4
	Graph   []ElementV0r4 `json:"graph"`
}

GraphV0r4 defines version 0.4 of the graphjson file format with an array of elements

func ReadArch

func ReadArch(arch string) *GraphV0r4

ReadArch parses graphjson

type GraphVersion

type GraphVersion struct {
	Version string `json:"version"`
}

GraphVersion extracts the version so it can be checked

type NodeV0r4

type NodeV0r4 struct {
	Node     string `json:"node"`
	Package  string `json:"package"`             // name changed from 0.3 to 0.4
	Tstamp   string `json:"timestamp,omitempty"` // 0.4
	Metadata string `json:"metadata,omitempty"`  // added to 0.4
}

NodeV0r4 defines a node for version 0.4, used to make json nodes for writing

Jump to

Keyboard shortcuts

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