Documentation ¶
Index ¶
- type Alert
- type AlertCondition
- type AlertLog
- type Scanner
- type ScannerRepository
- func (r *ScannerRepository) List() ([]*Scanner, error)
- func (r *ScannerRepository) LogAlert(ctx context.Context, alertLog *AlertLog) (uint, error)
- func (r *ScannerRepository) Upsert(ctx context.Context, scanner *Scanner) (uint, error)
- func (r *ScannerRepository) UpsertAlert(ctx context.Context, alert *Alert) (uint, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { gorm.Model Name string `gorm:"unique"` Action domain.AlertActionType `gorm:"comment:'Reboot=0, Sleep=1, Normal=2'"` State domain.AlertState `gorm:"comment:'Monitoring=0, Triggered=1, Resolving=2, Resolved=3'"` Active bool `gorm:"default:true"` Condition []AlertCondition `gorm:"foreignKey:AlertID;references:ID"` Log []AlertLog `gorm:"foreignKey:AlertID;references:ID"` ScannerID uint }
type AlertCondition ¶
type AlertCondition struct { gorm.Model TriggerValue domain.AlertTriggerValue `gorm:"comment:'Value for threshold (e.g. 100 TH/s, 80°C, and 100 RPM)'"` MachineCount domain.AlertMachineCount `gorm:"comment:'Number of machines for alert to get triggerred'"` ThresholdType domain.AlertThresholdType `gorm:"comment:'ThresholdCount=1, ThresholdRate=1'"` ConditionType domain.AlertConditionType `gorm:"comment:'Hashrate=0, Temperature=1, FanSpeed=2, PoolShares=3, OfflineMiners=4, MissingHashboards=5'"` LayerType domain.AlertLayerType `gorm:"comment:'InfoAlert=0, WarningAlert=1, ErrorAlert=2, FataltAlert=3'"` AlertID uint }
type ScannerRepository ¶
type ScannerRepository struct {
// contains filtered or unexported fields
}
TODO: preload with alerts and alert logs NOTE: alert condition order matters
func NewScannerRepository ¶
func NewScannerRepository(db *gorm.DB) *ScannerRepository
func (*ScannerRepository) List ¶
func (r *ScannerRepository) List() ([]*Scanner, error)
func (*ScannerRepository) UpsertAlert ¶
Click to show internal directories.
Click to hide internal directories.