aboutsummaryrefslogtreecommitdiff
path: root/go/topology/topology.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2014-03-10 11:43:54 -0700
committerChris Lu <chris.lu@gmail.com>2014-03-10 11:43:54 -0700
commitcd10c277b2146a7d01449dfe8825e7f1f12d7d7d (patch)
tree3f9bb75988e50aa2ddfc492fd45d27c6a748680f /go/topology/topology.go
parenta121453188f14ac3580bf61b47268bf029d61390 (diff)
downloadseaweedfs-cd10c277b2146a7d01449dfe8825e7f1f12d7d7d.tar.xz
seaweedfs-cd10c277b2146a7d01449dfe8825e7f1f12d7d7d.zip
can now delete a collection! Is this a dangerous feature? Only enabling
deleting "benchmark" collections for now.
Diffstat (limited to 'go/topology/topology.go')
-rw-r--r--go/topology/topology.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/go/topology/topology.go b/go/topology/topology.go
index 1426f7a12..d72879035 100644
--- a/go/topology/topology.go
+++ b/go/topology/topology.go
@@ -99,6 +99,15 @@ func (t *Topology) GetVolumeLayout(collectionName string, rp *storage.ReplicaPla
return t.collectionMap[collectionName].GetOrCreateVolumeLayout(rp)
}
+func (t *Topology) GetCollection(collectionName string) (collection *Collection, ok bool) {
+ collection, ok = t.collectionMap[collectionName]
+ return
+}
+
+func (t *Topology) DeleteCollection(collectionName string) {
+ delete(t.collectionMap, collectionName)
+}
+
func (t *Topology) RegisterVolumeLayout(v *storage.VolumeInfo, dn *DataNode) {
t.GetVolumeLayout(v.Collection, v.ReplicaPlacement).RegisterVolume(v, dn)
}
@@ -112,8 +121,8 @@ func (t *Topology) RegisterVolumes(init bool, volumeInfos []storage.VolumeInfo,
t.UnRegisterDataNode(dn)
}
dn = rack.GetOrCreateDataNode(ip, port, publicUrl, maxVolumeCount)
+ dn.UpdateVolumes(volumeInfos)
for _, v := range volumeInfos {
- dn.AddOrUpdateVolume(v)
t.RegisterVolumeLayout(&v, dn)
}
}