Unverified Commit 2f20fd31 authored by Péter Szilágyi's avatar Péter Szilágyi Committed by GitHub

core/rawdb: expose chain freezer constructor without internals (#26748)

parent 6d2d1261
...@@ -55,8 +55,8 @@ type chainFreezer struct { ...@@ -55,8 +55,8 @@ type chainFreezer struct {
} }
// newChainFreezer initializes the freezer for ancient chain data. // newChainFreezer initializes the freezer for ancient chain data.
func newChainFreezer(datadir string, namespace string, readonly bool, maxTableSize uint32, tables map[string]bool) (*chainFreezer, error) { func newChainFreezer(datadir string, namespace string, readonly bool) (*chainFreezer, error) {
freezer, err := NewFreezer(datadir, namespace, readonly, maxTableSize, tables) freezer, err := NewChainFreezer(datadir, namespace, readonly)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -200,7 +200,7 @@ func resolveChainFreezerDir(ancient string) string { ...@@ -200,7 +200,7 @@ func resolveChainFreezerDir(ancient string) string {
// where the chain freezer can be opened. // where the chain freezer can be opened.
func NewDatabaseWithFreezer(db ethdb.KeyValueStore, ancient string, namespace string, readonly bool) (ethdb.Database, error) { func NewDatabaseWithFreezer(db ethdb.KeyValueStore, ancient string, namespace string, readonly bool) (ethdb.Database, error) {
// Create the idle freezer instance // Create the idle freezer instance
frdb, err := newChainFreezer(resolveChainFreezerDir(ancient), namespace, readonly, freezerTableSize, chainFreezerNoSnappy) frdb, err := newChainFreezer(resolveChainFreezerDir(ancient), namespace, readonly)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -79,6 +79,12 @@ type Freezer struct { ...@@ -79,6 +79,12 @@ type Freezer struct {
closeOnce sync.Once closeOnce sync.Once
} }
// NewChainFreezer is a small utility method around NewFreezer that sets the
// default parameters for the chain storage.
func NewChainFreezer(datadir string, namespace string, readonly bool) (*Freezer, error) {
return NewFreezer(datadir, namespace, readonly, freezerTableSize, chainFreezerNoSnappy)
}
// NewFreezer creates a freezer instance for maintaining immutable ordered // NewFreezer creates a freezer instance for maintaining immutable ordered
// data according to the given parameters. // data according to the given parameters.
// //
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment