aboutsummaryrefslogtreecommitdiff
path: root/go/topology/topology.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2016-05-30 12:30:26 -0700
committerChris Lu <chris.lu@gmail.com>2016-05-30 12:30:26 -0700
commit6df18a918103634fd4e5e3297e9d2b1597ec5b73 (patch)
tree7d0e918cd4a04348eb2edf67f7951835ca20011d /go/topology/topology.go
parent46a89a7d61a269dbf8cfb1d113d328f138ac5361 (diff)
downloadseaweedfs-6df18a918103634fd4e5e3297e9d2b1597ec5b73.tar.xz
seaweedfs-6df18a918103634fd4e5e3297e9d2b1597ec5b73.zip
rwlock concurrent read map
Diffstat (limited to 'go/topology/topology.go')
-rw-r--r--go/topology/topology.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/go/topology/topology.go b/go/topology/topology.go
index ee1477cd2..088639eef 100644
--- a/go/topology/topology.go
+++ b/go/topology/topology.go
@@ -90,13 +90,13 @@ func (t *Topology) loadConfiguration(configurationFile string) error {
func (t *Topology) Lookup(collection string, vid storage.VolumeId) []*DataNode {
//maybe an issue if lots of collections?
if collection == "" {
- for _, c := range t.collectionMap.Items {
+ for _, c := range t.collectionMap.Items() {
if list := c.(*Collection).Lookup(vid); list != nil {
return list
}
}
} else {
- if c, ok := t.collectionMap.Items[collection]; ok {
+ if c, ok := t.collectionMap.Find(collection); ok {
return c.(*Collection).Lookup(vid)
}
}
@@ -130,13 +130,13 @@ func (t *Topology) GetVolumeLayout(collectionName string, rp *storage.ReplicaPla
}).(*Collection).GetOrCreateVolumeLayout(rp, ttl)
}
-func (t *Topology) GetCollection(collectionName string) (*Collection, bool) {
- c, hasCollection := t.collectionMap.Items[collectionName]
+func (t *Topology) FindCollection(collectionName string) (*Collection, bool) {
+ c, hasCollection := t.collectionMap.Find(collectionName)
return c.(*Collection), hasCollection
}
func (t *Topology) DeleteCollection(collectionName string) {
- delete(t.collectionMap.Items, collectionName)
+ t.collectionMap.Delete(collectionName)
}
func (t *Topology) RegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) {