core/rawdb: more accurate description of freezer in docs (#30393)
fixes https://github.com/ethereum/go-ethereum/issues/29793
This commit is contained in:
parent
7c6b3f9f14
commit
c0b5d428a9
|
@ -52,13 +52,11 @@ var (
|
||||||
// freezerTableSize defines the maximum size of freezer data files.
|
// freezerTableSize defines the maximum size of freezer data files.
|
||||||
const freezerTableSize = 2 * 1000 * 1000 * 1000
|
const freezerTableSize = 2 * 1000 * 1000 * 1000
|
||||||
|
|
||||||
// Freezer is a memory mapped append-only database to store immutable ordered
|
// Freezer is an append-only database to store immutable ordered data into
|
||||||
// data into flat files:
|
// flat files:
|
||||||
//
|
//
|
||||||
// - The append-only nature ensures that disk writes are minimized.
|
// - The append-only nature ensures that disk writes are minimized.
|
||||||
// - The memory mapping ensures we can max out system memory for caching without
|
// - The in-order data ensures that disk reads are always optimized.
|
||||||
// reserving it for go-ethereum. This would also reduce the memory requirements
|
|
||||||
// of Geth, and thus also GC overhead.
|
|
||||||
type Freezer struct {
|
type Freezer struct {
|
||||||
frozen atomic.Uint64 // Number of items already frozen
|
frozen atomic.Uint64 // Number of items already frozen
|
||||||
tail atomic.Uint64 // Number of the first stored item in the freezer
|
tail atomic.Uint64 // Number of the first stored item in the freezer
|
||||||
|
@ -152,7 +150,7 @@ func NewFreezer(datadir string, namespace string, readonly bool, maxTableSize ui
|
||||||
return freezer, nil
|
return freezer, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close terminates the chain freezer, unmapping all the data files.
|
// Close terminates the chain freezer, closing all the data files.
|
||||||
func (f *Freezer) Close() error {
|
func (f *Freezer) Close() error {
|
||||||
f.writeLock.Lock()
|
f.writeLock.Lock()
|
||||||
defer f.writeLock.Unlock()
|
defer f.writeLock.Unlock()
|
||||||
|
|
Loading…
Reference in New Issue