mirror of https://github.com/hashicorp/consul
Moves Serf helper into lib to fix import cycle in consul-enterprise.
parent
b1e45a8e89
commit
d12e81860f
|
@ -8,6 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/consul/agent/structs"
|
"github.com/hashicorp/consul/agent/structs"
|
||||||
|
"github.com/hashicorp/consul/lib"
|
||||||
"github.com/hashicorp/consul/tlsutil"
|
"github.com/hashicorp/consul/tlsutil"
|
||||||
"github.com/hashicorp/consul/types"
|
"github.com/hashicorp/consul/types"
|
||||||
"github.com/hashicorp/consul/version"
|
"github.com/hashicorp/consul/version"
|
||||||
|
@ -376,21 +377,6 @@ func (c *Config) CheckACL() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SerfDefaultConfig returns a Consul-flavored Serf default configuration,
|
|
||||||
// suitable as a basis for a LAN, WAN, segment, or area.
|
|
||||||
func SerfDefaultConfig() *serf.Config {
|
|
||||||
base := serf.DefaultConfig()
|
|
||||||
|
|
||||||
// This effectively disables the annoying queue depth warnings.
|
|
||||||
base.QueueDepthWarning = 1000000
|
|
||||||
|
|
||||||
// This enables dynamic sizing of the message queue depth based on the
|
|
||||||
// cluster size.
|
|
||||||
base.MinQueueDepth = 4096
|
|
||||||
|
|
||||||
return base
|
|
||||||
}
|
|
||||||
|
|
||||||
// DefaultConfig returns a sane default configuration.
|
// DefaultConfig returns a sane default configuration.
|
||||||
func DefaultConfig() *Config {
|
func DefaultConfig() *Config {
|
||||||
hostname, err := os.Hostname()
|
hostname, err := os.Hostname()
|
||||||
|
@ -404,8 +390,8 @@ func DefaultConfig() *Config {
|
||||||
NodeName: hostname,
|
NodeName: hostname,
|
||||||
RPCAddr: DefaultRPCAddr,
|
RPCAddr: DefaultRPCAddr,
|
||||||
RaftConfig: raft.DefaultConfig(),
|
RaftConfig: raft.DefaultConfig(),
|
||||||
SerfLANConfig: SerfDefaultConfig(),
|
SerfLANConfig: lib.SerfDefaultConfig(),
|
||||||
SerfWANConfig: SerfDefaultConfig(),
|
SerfWANConfig: lib.SerfDefaultConfig(),
|
||||||
SerfFloodInterval: 60 * time.Second,
|
SerfFloodInterval: 60 * time.Second,
|
||||||
ReconcileInterval: 60 * time.Second,
|
ReconcileInterval: 60 * time.Second,
|
||||||
ProtocolVersion: ProtocolVersion2Compatible,
|
ProtocolVersion: ProtocolVersion2Compatible,
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package lib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hashicorp/serf/serf"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SerfDefaultConfig returns a Consul-flavored Serf default configuration,
|
||||||
|
// suitable as a basis for a LAN, WAN, segment, or area.
|
||||||
|
func SerfDefaultConfig() *serf.Config {
|
||||||
|
base := serf.DefaultConfig()
|
||||||
|
|
||||||
|
// This effectively disables the annoying queue depth warnings.
|
||||||
|
base.QueueDepthWarning = 1000000
|
||||||
|
|
||||||
|
// This enables dynamic sizing of the message queue depth based on the
|
||||||
|
// cluster size.
|
||||||
|
base.MinQueueDepth = 4096
|
||||||
|
|
||||||
|
return base
|
||||||
|
}
|
Loading…
Reference in New Issue