mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-08-25 07:17:15 +08:00
list ec collections also
This commit is contained in:
parent
866197eee3
commit
e941d0c2f4
@ -19,7 +19,7 @@ func (ms *MasterServer) CollectionList(ctx context.Context, req *master_pb.Colle
|
|||||||
collections := ms.Topo.ListCollections()
|
collections := ms.Topo.ListCollections()
|
||||||
for _, c := range collections {
|
for _, c := range collections {
|
||||||
resp.Collections = append(resp.Collections, &master_pb.Collection{
|
resp.Collections = append(resp.Collections, &master_pb.Collection{
|
||||||
Name: c.Name,
|
Name: c,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,9 +126,21 @@ func (t *Topology) GetVolumeLayout(collectionName string, rp *storage.ReplicaPla
|
|||||||
}).(*Collection).GetOrCreateVolumeLayout(rp, ttl)
|
}).(*Collection).GetOrCreateVolumeLayout(rp, ttl)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Topology) ListCollections() (ret []*Collection) {
|
func (t *Topology) ListCollections() (ret []string) {
|
||||||
|
|
||||||
|
mapOfCollections := make(map[string]bool)
|
||||||
for _, c := range t.collectionMap.Items() {
|
for _, c := range t.collectionMap.Items() {
|
||||||
ret = append(ret, c.(*Collection))
|
mapOfCollections[c.(*Collection).Name] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
t.ecShardMapLock.RLock()
|
||||||
|
for _, ecVolumeLocation := range t.ecShardMap {
|
||||||
|
mapOfCollections[ecVolumeLocation.Collection] = true
|
||||||
|
}
|
||||||
|
t.ecShardMapLock.RUnlock()
|
||||||
|
|
||||||
|
for k, _ := range mapOfCollections {
|
||||||
|
ret = append(ret, k)
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user