accept changes

This commit is contained in:
VolodymyrBg 2025-11-17 12:20:38 +00:00
parent 030f628ca7
commit 15e5fd81c7
2 changed files with 7 additions and 9 deletions

View file

@ -35,17 +35,10 @@ type freezerInfo struct {
ancients uint64 // The total number of stored items in the freezer
head uint64 // The number of last stored item in the freezer, valid only if ancients > 0
tail uint64 // The number of first stored item in the freezer
count uint64 // The number of stored items in the freezer
sizes []tableSize // The storage size per table
}
// count returns the number of stored items in the freezer.
func (info *freezerInfo) count() uint64 {
if info.ancients <= info.tail {
return 0
}
return info.ancients - info.tail
}
// size returns the storage size of the entire freezer.
func (info *freezerInfo) size() common.StorageSize {
var total common.StorageSize
@ -82,6 +75,11 @@ func inspect(name string, order map[string]freezerTableConfig, reader ethdb.Anci
return freezerInfo{}, err
}
info.tail = tail
if ancients == 0 {
info.count = 0
} else {
info.count = info.head - info.tail + 1
}
return info, nil
}

View file

@ -644,7 +644,7 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error {
fmt.Sprintf("Ancient store (%s)", strings.Title(ancient.name)),
strings.Title(table.name),
table.size.String(),
fmt.Sprintf("%d", ancient.count()),
fmt.Sprintf("%d", ancient.count),
})
}
total.Add(uint64(ancient.size()))