From 74b81eeac1ae915134551b3e834c47fba71a4156 Mon Sep 17 00:00:00 2001 From: Travis Date: Fri, 17 Mar 2017 19:05:40 -0500 Subject: [PATCH] adjustments to support the new Config structure --- cmd/server.go | 5 ++++- config.go | 16 ++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cmd/server.go b/cmd/server.go index 82363f849..d25066764 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -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 } diff --git a/config.go b/config.go index 4c0554ad4..17edd639d 100644 --- a/config.go +++ b/config.go @@ -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 {