Documentation ¶
Index ¶
- Variables
- type AcceptedConfig
- type CGMQuitConfig
- type Data
- type Group
- type HighLoadConfig
- type HighTempConfig
- type LowMemoryConfig
- type Manager
- type ManagerData
- type MockManager
- type Monitor
- type NtpdateConfig
- type OnTick
- type RebootConfig
- type Result
- func NewAcceptedMonitor(config AcceptedConfig, client miner.Client, reboot os.Reboot) Result
- func NewCGMQuitMonitor(config CGMQuitConfig, client miner.Client) Result
- func NewHighTempMonitor(config HighTempConfig, client miner.Client, miner os.Miner) Result
- func NewLoadMonitor(config HighLoadConfig, retriever os.StatRetriever, reboot os.Reboot) Result
- func NewLowMemoryMonitor(config LowMemoryConfig, memInfo os.MemInfo, reboot os.Reboot) Result
- func NewNtpdateMonitor(config NtpdateConfig, ntpdate os.Ntpdate) Result
- func NewRebootMonitor(config RebootConfig, reboot os.Reboot) Result
- type Stop
- type TickerFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigProviders = fx.Options( fx.Provide(func(cfg agent.MonitorConfig) AcceptedConfig { value := cfg.AcceptedShares return AcceptedConfig{ Enabled: value.Enabled, Period: value.Period, } }), fx.Provide(func(cfg agent.MonitorConfig) HighLoadConfig { value := cfg.HighLoad return HighLoadConfig{ Enabled: value.Enabled, Period: value.Period, HighLoadMark: value.HighLoadMark, } }), fx.Provide(func(cfg agent.MonitorConfig) HighTempConfig { value := cfg.HighTemp return HighTempConfig{ Enabled: value.Enabled, Period: value.Period, HighTemp: value.HighTemp, } }), fx.Provide(func(cfg agent.MonitorConfig) CGMQuitConfig { value := cfg.CGMQuit return CGMQuitConfig{ Enabled: value.Enabled, Period: value.Period.Duration, } }), fx.Provide(func(cfg agent.MonitorConfig) RebootConfig { value := cfg.Reboot return RebootConfig{ Enabled: value.Enabled, Period: value.Period.Duration, } }), fx.Provide(func(cfg agent.MonitorConfig) LowMemoryConfig { value := cfg.LowMemory return LowMemoryConfig{ Enabled: value.Enabled, Period: value.Period, LowMemory: value.LowMemory, } }), fx.Provide(func(cfg agent.MonitorConfig) NtpdateConfig { value := cfg.Ntpdate return NtpdateConfig{ Enabled: value.Enabled, Period: value.Period, } }), )
Copy the config from the agent data source in order to keep the dependency between the config file (Entity) and the monitor layer clean via a DTO. Managed through the dependency injection so it is all cleanly done.
Functions ¶
This section is empty.
Types ¶
type AcceptedConfig ¶
type CGMQuitConfig ¶
type Data ¶
func (*Data) NewTickerFunc ¶
func (data *Data) NewTickerFunc() TickerFunc
type HighLoadConfig ¶
type HighTempConfig ¶
type LowMemoryConfig ¶
type Manager ¶
type Manager interface { Start() Stop() }
func NewManager ¶
There is a little fx magic here. Group gets magically populated with a list of monitors because those are provided in the module declaration below and we use the fx 'group' functionality to make that happen.
type ManagerData ¶
func (*ManagerData) Start ¶
func (mm *ManagerData) Start()
func (*ManagerData) Stop ¶
func (mm *ManagerData) Stop()
type MockManager ¶
func NewMockManager ¶
func NewMockManager() MockManager
func (*MockManager) Start ¶
func (mm *MockManager) Start()
func (*MockManager) Stop ¶
func (mm *MockManager) Stop()
type Monitor ¶
type Monitor interface { Start(ctx context.Context, wg *sync.WaitGroup, tickerFunc TickerFunc) IsEnabled() bool GetPeriod() time.Duration NewTickerFunc() TickerFunc }
type OnTick ¶
type OnTick func() TickerFunc
type RebootConfig ¶
type Result ¶
func NewAcceptedMonitor ¶
func NewCGMQuitMonitor ¶
func NewCGMQuitMonitor(config CGMQuitConfig, client miner.Client) Result
func NewHighTempMonitor ¶
func NewLoadMonitor ¶
func NewLoadMonitor(config HighLoadConfig, retriever os.StatRetriever, reboot os.Reboot) Result
func NewLowMemoryMonitor ¶
func NewNtpdateMonitor ¶
func NewNtpdateMonitor(config NtpdateConfig, ntpdate os.Ntpdate) Result
func NewRebootMonitor ¶
func NewRebootMonitor(config RebootConfig, reboot os.Reboot) Result
type TickerFunc ¶
Click to show internal directories.
Click to hide internal directories.