mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package server
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
// DefaultActiveSize is the default number of active followers allowed.
|
|
DefaultActiveSize = 9
|
|
|
|
// MinActiveSize is the minimum active size allowed.
|
|
MinActiveSize = 3
|
|
|
|
// DefaultPromoteDelay is the default elapsed time before promotion.
|
|
DefaultPromoteDelay = int((30 * time.Minute) / time.Second)
|
|
|
|
// MinPromoteDelay is the minimum promote delay allowed.
|
|
MinPromoteDelay = int((2 * time.Second) / time.Second)
|
|
)
|
|
|
|
// ClusterConfig represents cluster-wide configuration settings.
|
|
// These settings can only be changed through Raft.
|
|
type ClusterConfig struct {
|
|
// ActiveSize is the maximum number of node that can join as Raft followers.
|
|
// Nodes that join the cluster after the limit is reached are standbys.
|
|
ActiveSize int `json:"activeSize"`
|
|
|
|
// PromoteDelay is the amount of time, in seconds, after a node is
|
|
// unreachable that it will be swapped out for a standby node, if available.
|
|
PromoteDelay int `json:"promoteDelay"`
|
|
}
|
|
|
|
// NewClusterConfig returns a cluster configuration with default settings.
|
|
func NewClusterConfig() *ClusterConfig {
|
|
return &ClusterConfig{
|
|
ActiveSize: DefaultActiveSize,
|
|
PromoteDelay: DefaultPromoteDelay,
|
|
}
|
|
}
|