enc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CHAIN_SEPARATION_CHARACTER = "$$"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	ENCs        map[string]*ENC
	GlobPattern string
}

Config stores the configuration for our ENC

func NewConfig

func NewConfig(globPatttern string) *Config

NewConfig generates a new ENC from the config. One ENC for each file matched by the glob pattern

func (*Config) WriteOutENC added in v1.1.0

func (c *Config) WriteOutENC()

type ENC

type ENC struct {
	Name       string
	Nodegroups map[string]Nodegroup
	Nodes      *trie.Trie
	ConfigType string
	FileName   string
	ConfigLink *Config
}

ENC represents the entire structure of the External Node Classifier

func NewENC

func NewENC(configType string, fileName string) *ENC

NewENC initialises a new ENC

func (*ENC) AddClass

func (enc *ENC) AddClass(nodegroupName string, key string) (*Nodegroup, error)

AddClass initialises a new class for a nodegroup

func (*ENC) AddClassParameter

func (enc *ENC) AddClassParameter(nodegroupName string, class string, key string, val interface{}) (*Nodegroup, error)

AddClassParameter adds a parameter to a given class on a nodegroup

func (*ENC) AddNode

func (enc *ENC) AddNode(nodegroup string, nodeName string) (*Nodegroup, error)

AddNode adds a single node to a nodegroup

func (*ENC) AddNodegroup

func (enc *ENC) AddNodegroup(name string, parent string, classes map[string]interface{}, nodes []string, params map[string]interface{}) (*Nodegroup, error)

AddNodegroup adds a Nodegroup to the ENC

func (*ENC) AddNodes

func (enc *ENC) AddNodes(nodegroup string, nodes []string) (*Nodegroup, error)

AddNodes adds a slice of nodes to a nodegroup

func (*ENC) AddParameter

func (enc *ENC) AddParameter(nodegroupName string, key string, val interface{}) (*Nodegroup, error)

AddParameter add a parameter to a nodegroup

func (*ENC) ConflictMerge added in v1.2.0

func (enc *ENC) ConflictMerge(nodegroups []*Nodegroup) (*Nodegroup, error)

func (*ENC) GetChains added in v1.2.0

func (enc *ENC) GetChains(nodeName string) ([]string, error)

Get all possible parents for a node from the trie

func (*ENC) GetNode

func (enc *ENC) GetNode(nodeName string) (*Nodegroup, error)

GetNode retrieves a nodegroup that represents all inherited values for a node

func (*ENC) GetNodegroup

func (enc *ENC) GetNodegroup(nodegroupName string) (*Nodegroup, error)

GetNodegroup retrieves a nodegroup by name

func (*ENC) ParentChainWrapper added in v1.2.0

func (enc *ENC) ParentChainWrapper(nodegroupName string) []string

func (*ENC) RemoveClass

func (enc *ENC) RemoveClass(nodegroupName string, key string) (*Nodegroup, error)

RemoveClass removes a class from a nodegroup

func (*ENC) RemoveClassParameter

func (enc *ENC) RemoveClassParameter(nodegroupName string, class string, key string) (*Nodegroup, error)

RemoveClassParameter removes a parameter from a class

func (*ENC) RemoveNode

func (enc *ENC) RemoveNode(nodegroup string, nodeName string) (*Nodegroup, error)

RemoveNode removes a single node from a nodegroup

func (*ENC) RemoveNodegroup

func (enc *ENC) RemoveNodegroup(name string) (*Nodegroup, error)

RemoveNodegroup removes a nodegroup from the ENC

func (*ENC) RemoveParameter

func (enc *ENC) RemoveParameter(nodegroupName string, key string) (*Nodegroup, error)

RemoveParameter removes a parameter from a nodegroup

func (*ENC) SetClassParameter

func (enc *ENC) SetClassParameter(nodegroupName string, class string, key string, val interface{}) (*Nodegroup, error)

SetClassParameter is an alias for AddClassParameter

func (*ENC) SetEnvironment

func (enc *ENC) SetEnvironment(nodegroupName string, env string) (*Nodegroup, error)

SetEnvironment sets the value of the environment of a nodegroup

func (*ENC) SetParameter

func (enc *ENC) SetParameter(nodegroupName string, key string, val interface{}) (*Nodegroup, error)

SetParameter is an alias for AddParameter

func (*ENC) SetParent

func (enc *ENC) SetParent(nodegroupName string, parent string) (*Nodegroup, error)

SetParent sets the value of the parent of a nodegroup

type Nodegroup

type Nodegroup struct {
	Parent      string                 `json:"parent,omitempty" yaml:"parent,omitempty"`
	Classes     map[string]interface{} `json:"classes,omitempty" yaml:"classes,omitempty"`
	Nodes       []string               `json:"nodes,omitempty" yaml:"nodes,omitempty"`
	Parameters  map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Environment string                 `json:"environment,omitempty" yaml:"environment,omitempty"`
}

Nodegroup represents groups of nodes and meta information about them

Jump to

Keyboard shortcuts

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