diff options
| author | Chris Lu <chris.lu@gmail.com> | 2014-03-10 11:43:54 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2014-03-10 11:43:54 -0700 |
| commit | cd10c277b2146a7d01449dfe8825e7f1f12d7d7d (patch) | |
| tree | 3f9bb75988e50aa2ddfc492fd45d27c6a748680f /go/topology/topology.go | |
| parent | a121453188f14ac3580bf61b47268bf029d61390 (diff) | |
| download | seaweedfs-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.go | 11 |
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) } } |
