diff options
Diffstat (limited to 'weed/topology')
| -rw-r--r-- | weed/topology/configuration.go | 14 | ||||
| -rw-r--r-- | weed/topology/topology.go | 17 |
2 files changed, 3 insertions, 28 deletions
diff --git a/weed/topology/configuration.go b/weed/topology/configuration.go index ffcebb59c..2a544ce1d 100644 --- a/weed/topology/configuration.go +++ b/weed/topology/configuration.go @@ -25,20 +25,6 @@ type Configuration struct { ip2location map[string]loc } -func NewConfiguration(b []byte) (*Configuration, error) { - c := &Configuration{} - err := xml.Unmarshal(b, c) - c.ip2location = make(map[string]loc) - for _, dc := range c.Topo.DataCenters { - for _, rack := range dc.Racks { - for _, ip := range rack.Ips { - c.ip2location[ip] = loc{dcName: dc.Name, rackName: rack.Name} - } - } - } - return c, err -} - func (c *Configuration) String() string { if b, e := xml.MarshalIndent(c, " ", " "); e == nil { return string(b) diff --git a/weed/topology/topology.go b/weed/topology/topology.go index ffd32ae21..1c5633e95 100644 --- a/weed/topology/topology.go +++ b/weed/topology/topology.go @@ -2,7 +2,6 @@ package topology import ( "errors" - "io/ioutil" "math/rand" "github.com/chrislusf/raft" @@ -30,7 +29,7 @@ type Topology struct { RaftServer raft.Server } -func NewTopology(id string, confFile string, seq sequence.Sequencer, volumeSizeLimit uint64, pulse int) (*Topology, error) { +func NewTopology(id string, seq sequence.Sequencer, volumeSizeLimit uint64, pulse int) *Topology { t := &Topology{} t.id = NodeId(id) t.nodeType = "Topology" @@ -44,9 +43,9 @@ func NewTopology(id string, confFile string, seq sequence.Sequencer, volumeSizeL t.chanFullVolumes = make(chan storage.VolumeInfo) - err := t.loadConfiguration(confFile) + t.Configuration = &Configuration{} - return t, err + return t } func (t *Topology) IsLeader() bool { @@ -72,16 +71,6 @@ func (t *Topology) Leader() (string, error) { return l, nil } -func (t *Topology) loadConfiguration(configurationFile string) error { - b, e := ioutil.ReadFile(configurationFile) - if e == nil { - t.Configuration, e = NewConfiguration(b) - return e - } - glog.V(0).Infoln("Using default configurations.") - return nil -} - func (t *Topology) Lookup(collection string, vid storage.VolumeId) []*DataNode { //maybe an issue if lots of collections? if collection == "" { |
