frostfs-node/pkg/network/transport/object/grpc/capacity.go
Stanislav Bogatyrev b7b5079934 Add Inner Ring code
2020-07-24 17:07:37 +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
}