1
0
Fork 0

feat: initial release

This commit is contained in:
Arthur K. 2026-01-17 18:14:50 +03:00
parent a3cf21f5bd
commit 761174d035
Signed by: wzray
GPG key ID: B97F30FDC4636357
41 changed files with 2008 additions and 217 deletions

47
internal/config/master.go Normal file
View file

@ -0,0 +1,47 @@
package config
import "errors"
type MasterConfig struct {
ObserverInterval int `toml:"observer_interval"`
BackoffSeconds int `toml:"backoff_seconds"`
BackoffCount int `toml:"backoff_count"`
baseRoleConfig
}
func (c MasterConfig) Validate() error {
if c.ObserverInterval < 1 {
return errors.New("invalid observer_interval")
}
if c.BackoffSeconds < 1 {
return errors.New("invalid backoff_seconds")
}
if c.BackoffCount < 1 {
return errors.New("invalid backoff_count")
}
return nil
}
func (c *MasterConfig) Merge(other MasterConfig) {
if other.set {
c.set = true
}
if other.ObserverInterval != 0 {
c.ObserverInterval = other.ObserverInterval
}
if other.BackoffSeconds != 0 {
c.BackoffSeconds = other.BackoffSeconds
}
if other.BackoffCount != 0 {
c.BackoffCount = other.BackoffCount
}
}