|
|
|
@ -58,8 +58,9 @@ const freezerTableSize = 2 * 1000 * 1000 * 1000 |
|
|
|
|
// - The append-only nature ensures that disk writes are minimized.
|
|
|
|
|
// - The in-order data ensures that disk reads are always optimized.
|
|
|
|
|
type Freezer struct { |
|
|
|
|
frozen atomic.Uint64 // Number of items already frozen
|
|
|
|
|
tail atomic.Uint64 // Number of the first stored item in the freezer
|
|
|
|
|
datadir string |
|
|
|
|
frozen atomic.Uint64 // Number of items already frozen
|
|
|
|
|
tail atomic.Uint64 // Number of the first stored item in the freezer
|
|
|
|
|
|
|
|
|
|
// This lock synchronizes writers and the truncate operation, as well as
|
|
|
|
|
// the "atomic" (batched) read operations.
|
|
|
|
@ -109,6 +110,7 @@ func NewFreezer(datadir string, namespace string, readonly bool, maxTableSize ui |
|
|
|
|
} |
|
|
|
|
// Open all the supported data tables
|
|
|
|
|
freezer := &Freezer{ |
|
|
|
|
datadir: datadir, |
|
|
|
|
readonly: readonly, |
|
|
|
|
tables: make(map[string]*freezerTable), |
|
|
|
|
instanceLock: lock, |
|
|
|
@ -172,6 +174,11 @@ func (f *Freezer) Close() error { |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// AncientDatadir returns the path of the ancient store.
|
|
|
|
|
func (f *Freezer) AncientDatadir() (string, error) { |
|
|
|
|
return f.datadir, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// HasAncient returns an indicator whether the specified ancient data exists
|
|
|
|
|
// in the freezer.
|
|
|
|
|
func (f *Freezer) HasAncient(kind string, number uint64) (bool, error) { |
|
|
|
|