forked from TrueCloudLab/frostfs-node
To drop unnecessary parameters and return values. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
24 lines
563 B
Go
24 lines
563 B
Go
package writecache
|
|
|
|
func (c *cache) estimateCacheSize() (uint64, uint64) {
|
|
count, size := c.counter.CountSize()
|
|
c.metrics.SetEstimateSize(size)
|
|
c.metrics.SetActualCounters(count)
|
|
return count, size
|
|
}
|
|
|
|
func (c *cache) hasEnoughSpaceFS() bool {
|
|
return c.hasEnoughSpace(c.maxObjectSize)
|
|
}
|
|
|
|
func (c *cache) hasEnoughSpace(objectSize uint64) bool {
|
|
count, size := c.estimateCacheSize()
|
|
if c.maxCacheCount > 0 && count+1 > c.maxCacheCount {
|
|
return false
|
|
}
|
|
return c.maxCacheSize >= size+objectSize
|
|
}
|
|
|
|
func (c *cache) initCounters() {
|
|
c.estimateCacheSize()
|
|
}
|