agent

package
v0.0.0-...-f7edce5 Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigControllerModule = fx.Provide(
	NewConfigController,
	NewControllerConfig,
)
View Source
var ConfigLocationModule = fx.Provide(
	NewConfigLocation,
	NewLocationConfig,
)
View Source
var ConfigModule = fx.Options(
	fx.Provide(func(cmdLine tool.CmdLine, confRiceBox tool.ConfRiceBox) Config {
		data, err := (*confRiceBox).Bytes("bam_agent.json")
		if err != nil {
			log.Panic("could not load bam_agent.json from rice")
			return nil
		}
		return NewConfig(cmdLine, data)
	}),

	ConfigMonitorModule,
	ConfigControllerModule,
	ConfigLocationModule,
)
View Source
var ConfigMonitorModule = fx.Provide(
	NewConfigMonitor,
	NewMonitorConfig,
)
View Source
var VersionModule = fx.Provide(NewVersion)

Functions

This section is empty.

Types

type AcceptedConfig

type AcceptedConfig struct {
	Enabled bool          `json:"enabled"`
	Period  time.Duration `json:"period"`
}

type CGMQuitConfig

type CGMQuitConfig struct {
	Enabled bool                `json:"enabled"`
	Period  tool.RandomDuration `json:"period"`
}

type Config

type Config interface {
	Load() error
	Save() error
	Original() *gabs.Container
	Loaded() *FileConfig
	Update(path string, data interface{}) error
}

func NewConfig

func NewConfig(cmdLine tool.CmdLine, defaultConfig []byte) Config

Returns a loaded config object based on the parameters passed in from the cmdLine.

type ConfigController

type ConfigController interface {
	Get() ControllerConfig
	Update(cc ControllerConfig) error
}

func NewConfigController

func NewConfigController(cfg Config) ConfigController

type ConfigData

type ConfigData struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*ConfigData) Data

func (cfg *ConfigData) Data() Config

func (*ConfigData) Load

func (cfg *ConfigData) Load() error

func (*ConfigData) Loaded

func (cfg *ConfigData) Loaded() *FileConfig

func (*ConfigData) Original

func (cfg *ConfigData) Original() *gabs.Container

func (*ConfigData) Save

func (cfg *ConfigData) Save() error

func (*ConfigData) Update

func (cfg *ConfigData) Update(path string, data interface{}) error

type ConfigLocation

type ConfigLocation interface {
	Parse(data []byte) (*LocationConfig, error)
	Get() LocationConfig
	Update(mc LocationConfig) error
}

func NewConfigLocation

func NewConfigLocation(cfg Config) ConfigLocation

type ConfigMonitor

type ConfigMonitor interface {
	Get() MonitorConfig
	Update(mc MonitorConfig) error
}

func NewConfigMonitor

func NewConfigMonitor(cfg Config) ConfigMonitor

type ControllerConfig

type ControllerConfig struct {
	Reboot ControllerRebootConfig `json:"reboot"`
}

Controller

func NewControllerConfig

func NewControllerConfig(cfg ConfigController) ControllerConfig

type ControllerHelper

type ControllerHelper struct {
	Config
}

func (*ControllerHelper) Get

func (*ControllerHelper) Update

func (ch *ControllerHelper) Update(cc ControllerConfig) error

type ControllerRebootConfig

type ControllerRebootConfig struct {
	Delay time.Duration `json:"delay"`
}

type FileConfig

type FileConfig struct {
	CmdLine    tool.CmdLine     `json:"cmdLine"`
	Location   LocationConfig   `json:"location"`
	Monitor    MonitorConfig    `json:"monitor"`
	Controller ControllerConfig `json:"controller"`
}

Top level config for the bam_agent.json file

type HighLoadConfig

type HighLoadConfig struct {
	Enabled      bool          `json:"enabled"`
	Period       time.Duration `json:"period"`
	HighLoadMark float64       `json:"highLoadMark"`
}

type HighTempConfig

type HighTempConfig struct {
	Enabled  bool          `json:"enabled"`
	Period   time.Duration `json:"period"`
	HighTemp float64       `json:"highTemp"`
}

type LocationConfig

type LocationConfig struct {
	Facility string `json:"facility"`
	Rack     string `json:"rack"`
	Row      string `json:"row"`
	Shelf    int    `json:"shelf"`
	Position int    `json:"position"`
}

Location

func NewLocationConfig

func NewLocationConfig(cfg ConfigLocation) LocationConfig

type LocationHelper

type LocationHelper struct {
	Config
}

func (*LocationHelper) Get

func (mh *LocationHelper) Get() LocationConfig

func (*LocationHelper) Parse

func (mh *LocationHelper) Parse(data []byte) (*LocationConfig, error)

func (*LocationHelper) Update

func (mh *LocationHelper) Update(mc LocationConfig) error

type LowMemoryConfig

type LowMemoryConfig struct {
	Enabled   bool          `json:"enabled"`
	Period    time.Duration `json:"period"`
	LowMemory float64       `json:"lowMemory"`
}

type MockConfig

type MockConfig struct {
	CalledSave bool
	// contains filtered or unexported fields
}

func NewMockConfig

func NewMockConfig() *MockConfig

func (*MockConfig) Load

func (cfg *MockConfig) Load() error

func (*MockConfig) Loaded

func (cfg *MockConfig) Loaded() *FileConfig

func (*MockConfig) Original

func (cfg *MockConfig) Original() *gabs.Container

func (*MockConfig) Save

func (cfg *MockConfig) Save() error

func (*MockConfig) Update

func (cfg *MockConfig) Update(path string, data interface{}) error

type MonitorConfig

type MonitorConfig struct {
	HighLoad       HighLoadConfig  `json:"highLoad"`
	HighTemp       HighTempConfig  `json:"highTemperature"`
	AcceptedShares AcceptedConfig  `json:"acceptedShares"`
	CGMQuit        CGMQuitConfig   `json:"cgMinerQuit"`
	Reboot         RebootConfig    `json:"reboot"`
	LowMemory      LowMemoryConfig `json:"lowMemory"`
	Ntpdate        NtpdateConfig   `json:"ntpdate"`
}

Monitor

func NewMonitorConfig

func NewMonitorConfig(cfg ConfigMonitor) MonitorConfig

type MonitorHelper

type MonitorHelper struct {
	Config
}

func (*MonitorHelper) Get

func (mh *MonitorHelper) Get() MonitorConfig

func (*MonitorHelper) Update

func (mh *MonitorHelper) Update(mc MonitorConfig) error

type NtpdateConfig

type NtpdateConfig struct {
	Enabled bool          `json:"enabled"`
	Period  time.Duration `json:"period"`
	Server  string        `json:"server"`
}

type RebootConfig

type RebootConfig struct {
	Enabled bool                `json:"enabled"`
	Period  tool.RandomDuration `json:"period"`
}

type Version

type Version struct {
	V string
}

func NewVersion

func NewVersion() Version

Jump to

Keyboard shortcuts

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