config

package
v0.0.0-...-f78b0ad Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StageToString

func StageToString(s *Stage) string

StageToString convert a Stage struct to string for debugging

Types

type Agent

type Agent struct {
	Role     string            // role of node
	Address  string            // agent's IP
	Version  string            // agent's version for compatibility
	Selector map[string]string // selector for the agent
}

Agent is a standalone controller at a node

type ControllerConfig

type ControllerConfig struct {
	SystemTap  *SystemTap          `yaml:"systemtap"` // systemtap configuration
	ServiceMap map[string]*Service `yaml:"service"`   // service configuration
}

ControllerConfig is the base configuration of controller

func LoadControllerConfigFromFile

func LoadControllerConfigFromFile(file string) (*ControllerConfig, error)

LoadControllerConfigFromFile create controller configuration from file

func (*ControllerConfig) String

func (c *ControllerConfig) String() string

type Selector

type Selector map[string]string

Selector is a filter for agent

type Service

type Service struct {
	Start string `yaml:"start"` // command to start the service
	Stop  string `yaml:"stop"`  // command to stop the service
}

Service set the env of service

type Stage

type Stage struct {
	Name            string             `yaml:"name"`
	Description     string             `yaml:"description"`
	TaskList        []*Task            `yaml:"tasks"`
	TaskDict        map[string]*Task   `yaml:"-"`
	TaskRequireDict map[string][]*Task `yaml:"-"`
}

Stage is a group of tasks within a closure

func LoadStageFromDir

func LoadStageFromDir(dir string) ([]*Stage, error)

LoadStageFromDir load all stage from data dir

func LoadStageFromFile

func LoadStageFromFile(file string) (*Stage, error)

LoadStageFromFile create a stage configuration from file

type Strategy

type Strategy struct {
	Selector    string `yaml:"selector"`     // node selector, randomly select currently
	TickerCycle int    `yaml:"ticker_cycle"` // ticker Cycle
	TickerLast  int    `yaml:"ticker_last"`  // ticker duration
	Timeout     int    `yaml:"timeout"`      // timeout configuration
	Limit       int    `yaml:"limit"`        // limitation of nodes selected
}

Strategy specifies how to run tasks

func (*Strategy) ToSelector

func (s *Strategy) ToSelector() Selector

ToSelector create a Selector form Strategy

type SystemTap

type SystemTap struct {
	ScriptDir  string `yaml:"script_dir"` // dir of the systemtap script
	IOProbeDir string `yaml:"probe_dir"`  // dir to probe
	PidFile    string `yaml:"pidfile"`    // file to get pid
}

SystemTap set the env for systemtap

type Task

type Task struct {
	Type      string            `yaml:"type"`      // type of task, eg. nemesis timer
	Name      string            `yaml:"name"`      // unique name of the task
	Arguments map[string]string `yaml:"arguments"` // arguments to run the task
	Strategy  Strategy          `yaml:"strategy"`  // rule to select node
	Requires  []string          `yaml:"requires"`  // upstream of this task
	ID        string            `yaml:"-"`
}

Task configuration

type Topology

type Topology map[string]*Agent

Topology is a view of the whole cluster

func (Topology) Select

func (t Topology) Select(selector Selector) []*Agent

Select get a or some agent according to selector

Jump to

Keyboard shortcuts

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