2015-06-02 21:40:17 +00:00
|
|
|
package hh
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/influxdb/influxdb/toml"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// DefaultMaxSize is the default maximum size of all hinted handoff queues in bytes.
|
2015-06-05 05:03:15 +00:00
|
|
|
DefaultMaxSize = 1024 * 1024 * 1024
|
2015-06-02 21:40:17 +00:00
|
|
|
|
|
|
|
// DefaultRetryInterval is the default amout of time the system waits before
|
|
|
|
// attempting to flush hinted handoff queues.
|
|
|
|
DefaultRetryInterval = time.Second
|
|
|
|
|
|
|
|
// DefaultMaxBackoffTime is the default maximum time to wait when a node with pending
|
|
|
|
// hinted handoff writes is unavailable.
|
|
|
|
DefaultMaxBackoffTime = 5 * time.Minute
|
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
Enabled bool `toml:"enabled"`
|
2015-06-05 05:03:15 +00:00
|
|
|
Dir string `toml:"dir"`
|
|
|
|
MaxSize int64 `toml:"max-size"`
|
2015-06-02 21:40:17 +00:00
|
|
|
RetryInterval toml.Duration `toml:"retry-interval"`
|
|
|
|
MaxBackoffTime toml.Duration `toml:"max-backoff-time"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewConfig() Config {
|
|
|
|
return Config{
|
|
|
|
Enabled: true,
|
|
|
|
MaxSize: DefaultMaxSize,
|
|
|
|
RetryInterval: toml.Duration(DefaultRetryInterval),
|
|
|
|
MaxBackoffTime: toml.Duration(DefaultMaxBackoffTime),
|
|
|
|
}
|
|
|
|
}
|