adjustments to support the new Config structure

This commit is contained in:
Travis 2017-03-17 19:05:40 -05:00
parent 8fa45649b6
commit 74b81eeac1
2 changed files with 10 additions and 11 deletions

View file

@ -75,7 +75,7 @@ on the configured port.`,
flags.StringVarP(&Server.Config.DataDir, "data-dir", "d", "~/.pilosa", "Directory to store pilosa data files.")
flags.StringVarP(&Server.Config.Host, "bind", "b", ":10101", "Default URI on which pilosa should listen.")
flags.IntVarP(&Server.Config.Cluster.ReplicaN, "cluster.replicas", "", 1, "Number hosts each piece of data should be stored on.")
flags.IntVarP(&Server.Config.Cluster.ReplicaN, "cluster.replicas", "", 1, "Number of hosts each piece of data should be stored on.")
flags.StringSliceVarP(&Server.Config.Cluster.Nodes, "cluster.hosts", "", []string{}, "Comma separated list of hosts in cluster.")
flags.DurationVarP((*time.Duration)(&Server.Config.Cluster.PollingInterval), "cluster.poll-interval", "", time.Minute, "Polling interval for cluster.") // TODO what actually is this?
flags.StringVarP(&Server.Config.Plugins.Path, "plugins.path", "", "", "Path to plugin directory.")
@ -83,6 +83,9 @@ on the configured port.`,
flags.DurationVarP((*time.Duration)(&Server.Config.AntiEntropy.Interval), "anti-entropy.interval", "", time.Minute*10, "Interval at which to run anti-entropy routine.")
flags.StringVarP(&Server.CPUProfile, "profile.cpu", "", "", "Where to store CPU profile.")
flags.DurationVarP(&Server.CPUTime, "profile.cpu-time", "", 30*time.Second, "CPU profile duration.")
flags.StringVarP(&Server.Config.Cluster.MessengerType, "cluster.messenger-type", "", "", "Type of Messenger to use for inter-host messaging.")
flags.StringVarP(&Server.Config.Cluster.Gossip.Seed, "cluster.gossip.seed", "", "", "Host with which to seed the gossip membership.")
flags.IntVarP(&Server.Config.Cluster.Gossip.Port, "cluster.gossip.port", "", 0, "Port to which pilosa should bind for gossip.")
return serveCmd
}

View file

@ -18,11 +18,11 @@ type Config struct {
Host string `toml:"host"`
Cluster struct {
ReplicaN int `toml:"replicas"`
MessengerType string `toml:"messenger-type"`
Nodes []string `toml:"hosts"`
PollingInterval Duration `toml:"polling-interval"`
Gossip *ConfigGossip `toml:"gossip"`
ReplicaN int `toml:"replicas"`
MessengerType string `toml:"messenger-type"`
Nodes []string `toml:"hosts"`
PollingInterval Duration `toml:"polling-interval"`
Gossip ConfigGossip `toml:"gossip"`
} `toml:"cluster"`
Plugins struct {
@ -36,10 +36,6 @@ type Config struct {
LogPath string `toml:"log-path"`
}
type ConfigNode struct {
Host string `toml:"host"`
}
type ConfigGossip struct {
Port int `toml:"port"`
Seed string `toml:"seed"`
@ -80,7 +76,7 @@ func (c *Config) PilosaCluster() *Cluster {
if c.Cluster.MessengerType == "broadcast" {
cluster.NodeSet = NewHTTPNodeSet()
cluster.NodeSet.Join(cluster.Nodes)
} else if (c.Cluster.MessengerType == "gossip") && (c.Cluster.Gossip != nil) {
} else if c.Cluster.MessengerType == "gossip" {
gossipPort := DefaultGossipPort
gossipSeed := DefaultHost
if c.Cluster.Gossip.Port != 0 {