frostfs-node/services/public/object/capacity.go
alexvanin dadfd90dcd Initial commit
Initial public review release v0.10.0
2020-07-10 17:45:00 +03:00

19 lines
350 B
Go

package object
func (s *objectService) RelativeAvailableCap() float64 {
diff := float64(s.ls.Size()) / float64(s.storageCap)
if 1-diff < 0 {
return 0
}
return 1 - diff
}
func (s *objectService) AbsoluteAvailableCap() uint64 {
localSize := uint64(s.ls.Size())
if localSize > s.storageCap {
return 0
}
return s.storageCap - localSize
}