add http endpoint to get the size of a collection (#5910)

This commit is contained in:
Riccardo Bertossa
2024-08-19 16:44:45 +02:00
committed by GitHub
parent e50d85c0f3
commit 6fe8639504
3 changed files with 78 additions and 0 deletions

View File

@@ -44,6 +44,28 @@ func (c *Collection) GetOrCreateVolumeLayout(rp *super_block.ReplicaPlacement, t
return vl.(*VolumeLayout)
}
func (c *Collection) GetVolumeLayout(rp *super_block.ReplicaPlacement, ttl *needle.TTL, diskType types.DiskType) (*VolumeLayout, bool) {
keyString := rp.String()
if ttl != nil {
keyString += ttl.String()
}
if diskType != types.HardDriveType {
keyString += string(diskType)
}
vl, ok := c.storageType2VolumeLayout.Find(keyString)
return vl.(*VolumeLayout), ok
}
func (c *Collection) GetAllVolumeLayouts() []*VolumeLayout {
var vls []*VolumeLayout
for _, vl := range c.storageType2VolumeLayout.Items() {
if vl != nil {
vls = append(vls, vl.(*VolumeLayout))
}
}
return vls
}
func (c *Collection) DeleteVolumeLayout(rp *super_block.ReplicaPlacement, ttl *needle.TTL, diskType types.DiskType) {
keyString := rp.String()
if ttl != nil {