Documentation
¶
Index ¶
- Variables
- type AcceptedConfig
- type CGMQuitConfig
- type Config
- type ConfigController
- type ConfigData
- type ConfigLocation
- type ConfigMonitor
- type ControllerConfig
- type ControllerHelper
- type ControllerRebootConfig
- type FileConfig
- type HighLoadConfig
- type HighTempConfig
- type LocationConfig
- type LocationHelper
- type LowMemoryConfig
- type MockConfig
- type MonitorConfig
- type MonitorHelper
- type NtpdateConfig
- type RebootConfig
- type Version
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 CGMQuitConfig ¶
type CGMQuitConfig struct {
Enabled bool `json:"enabled"`
Period tool.RandomDuration `json:"period"`
}
type Config ¶
type ConfigController ¶
type ConfigController interface {
Get() ControllerConfig
Update(cc ControllerConfig) error
}
func NewConfigController ¶
func NewConfigController(cfg Config) ConfigController
type ConfigData ¶
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 (ch *ControllerHelper) Get() ControllerConfig
func (*ControllerHelper) Update ¶
func (ch *ControllerHelper) Update(cc ControllerConfig) error
type ControllerRebootConfig ¶
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 HighTempConfig ¶
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 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"`
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 RebootConfig ¶
type RebootConfig struct {
Enabled bool `json:"enabled"`
Period tool.RandomDuration `json:"period"`
}
Click to show internal directories.
Click to hide internal directories.