MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / diskCapacityBytes

Method diskCapacityBytes

internal/caches/storage_file.go:1372–1390  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1370}
1371
1372func (this *FileStorage) diskCapacityBytes() int64 {
1373 var c1 = this.policy.CapacityBytes()
1374 var nodeCapacity = SharedManager.MaxDiskCapacity // copy
1375 if nodeCapacity != nil {
1376 var c2 = nodeCapacity.Bytes()
1377 if c2 > 0 {
1378 if this.mainDiskTotalSize > 0 && c2 >= int64(this.mainDiskTotalSize) {
1379 c2 = int64(this.mainDiskTotalSize) * 95 / 100 // keep 5% free
1380 }
1381 return c2
1382 }
1383 }
1384
1385 if c1 <= 0 || (this.mainDiskTotalSize > 0 && c1 >= int64(this.mainDiskTotalSize)) {
1386 c1 = int64(this.mainDiskTotalSize) * 95 / 100 // keep 5% free
1387 }
1388
1389 return c1
1390}
1391
1392// remove all *.trash directories under policy directory
1393func (this *FileStorage) cleanAllDeletedDirs() {

Callers 2

openWriterMethod · 0.95
purgeLoopMethod · 0.95

Calls 1

BytesMethod · 0.80

Tested by

no test coverage detected