cluster_config.go 877 B

12345678910111213141516171819202122232425
  1. package config
  2. // ClusterConfig represents cluster-wide configuration settings.
  3. type ClusterConfig struct {
  4. // ActiveSize is the maximum number of node that can join as Raft followers.
  5. // Nodes that join the cluster after the limit is reached are standbys.
  6. ActiveSize int `json:"activeSize"`
  7. // RemoveDelay is the amount of time, in seconds, after a node is
  8. // unreachable that it will be swapped out as a standby node.
  9. RemoveDelay float64 `json:"removeDelay"`
  10. // SyncInterval is the amount of time, in seconds, between
  11. // cluster sync when it runs in standby mode.
  12. SyncInterval float64 `json:"syncInterval"`
  13. }
  14. // NewClusterConfig returns a cluster configuration with default settings.
  15. func NewClusterConfig() *ClusterConfig {
  16. return &ClusterConfig{
  17. ActiveSize: DefaultActiveSize,
  18. RemoveDelay: DefaultRemoveDelay,
  19. SyncInterval: DefaultSyncInterval,
  20. }
  21. }