Add prefixes usage in Accounting Usage Info (#12687)

This commit is contained in:
Anis Elleuch
2021-07-13 18:42:11 +01:00
committed by GitHub
parent e316873f84
commit aa78505181
4 changed files with 83 additions and 0 deletions

View File

@@ -530,6 +530,18 @@ func (h dataUsageHash) Key() string {
return string(h)
}
func (d *dataUsageCache) flattenChildrens(root dataUsageEntry) (m map[string]dataUsageEntry) {
m = make(map[string]dataUsageEntry)
for id := range root.Children {
e := d.Cache[id]
if len(e.Children) > 0 {
e = d.flatten(e)
}
m[id] = e
}
return m
}
// flatten all children of the root into the root element and return it.
func (d *dataUsageCache) flatten(root dataUsageEntry) dataUsageEntry {
for id := range root.Children {