2015-05-29 19:50:05 +00:00
|
|
|
package cluster
|
|
|
|
|
2015-05-30 20:00:46 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/influxdb/influxdb/toml"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2015-07-02 16:32:28 +00:00
|
|
|
// DefaultWriteTimeout is the default timeout for a complete write to succeed.
|
|
|
|
DefaultWriteTimeout = 5 * time.Second
|
|
|
|
|
2015-05-30 20:00:46 +00:00
|
|
|
// DefaultShardWriterTimeout is the default timeout set on shard writers.
|
|
|
|
DefaultShardWriterTimeout = 5 * time.Second
|
2015-07-16 21:27:29 +00:00
|
|
|
|
|
|
|
// DefaultShardMapperTimeout is the default timeout set on shard mappers.
|
|
|
|
DefaultShardMapperTimeout = 5 * time.Second
|
2016-01-26 22:53:50 +00:00
|
|
|
|
|
|
|
// DefaultMaxRemoteWriteConnections is the maximum number of open connections
|
|
|
|
// that will be available for remote writes to another host.
|
|
|
|
DefaultMaxRemoteWriteConnections = 3
|
2015-05-30 20:00:46 +00:00
|
|
|
)
|
|
|
|
|
2015-07-16 21:27:29 +00:00
|
|
|
// Config represents the configuration for the clustering service.
|
2015-05-30 20:00:46 +00:00
|
|
|
type Config struct {
|
2016-01-26 22:53:50 +00:00
|
|
|
ForceRemoteShardMapping bool `toml:"force-remote-mapping"`
|
|
|
|
WriteTimeout toml.Duration `toml:"write-timeout"`
|
|
|
|
ShardWriterTimeout toml.Duration `toml:"shard-writer-timeout"`
|
|
|
|
MaxRemoteWriteConnections int `toml:"max-remote-write-connections"`
|
|
|
|
ShardMapperTimeout toml.Duration `toml:"shard-mapper-timeout"`
|
2015-05-30 20:00:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewConfig returns an instance of Config with defaults.
|
|
|
|
func NewConfig() Config {
|
|
|
|
return Config{
|
2016-01-26 22:53:50 +00:00
|
|
|
WriteTimeout: toml.Duration(DefaultWriteTimeout),
|
|
|
|
ShardWriterTimeout: toml.Duration(DefaultShardWriterTimeout),
|
|
|
|
ShardMapperTimeout: toml.Duration(DefaultShardMapperTimeout),
|
|
|
|
MaxRemoteWriteConnections: DefaultMaxRemoteWriteConnections,
|
2015-05-30 20:00:46 +00:00
|
|
|
}
|
|
|
|
}
|