@@ -28,6 +28,7 @@ import (
28
28
"github.com/ethereum/go-ethereum/ethdb"
29
29
"github.com/ethereum/go-ethereum/ethdb/leveldb"
30
30
"github.com/ethereum/go-ethereum/ethdb/memorydb"
31
+ "github.com/ethereum/go-ethereum/ethdb/pebble"
31
32
"github.com/ethereum/go-ethereum/log"
32
33
"github.com/olekukonko/tablewriter"
33
34
)
@@ -251,6 +252,16 @@ func NewLevelDBDatabase(file string, cache int, handles int, namespace string, r
251
252
return NewDatabase (db ), nil
252
253
}
253
254
255
+ // NewPebbleDBDatabase creates a persistent key-value database without a freezer
256
+ // moving immutable chain segments into cold storage.
257
+ func NewPebbleDBDatabase (file string , cache int , handles int , namespace string , readonly bool ) (ethdb.Database , error ) {
258
+ db , err := pebble .New (file , cache , handles , namespace , readonly )
259
+ if err != nil {
260
+ return nil , err
261
+ }
262
+ return NewDatabase (db ), nil
263
+ }
264
+
254
265
// NewLevelDBDatabaseWithFreezer creates a persistent key-value database with a
255
266
// freezer moving immutable chain segments into cold storage.
256
267
func NewLevelDBDatabaseWithFreezer (file string , cache int , handles int , freezer string , namespace string , readonly bool ) (ethdb.Database , error ) {
@@ -266,6 +277,21 @@ func NewLevelDBDatabaseWithFreezer(file string, cache int, handles int, freezer
266
277
return frdb , nil
267
278
}
268
279
280
+ // NewPebbleDBDatabaseWithFreezer creates a persistent key-value database with a
281
+ // freezer moving immutable chain segments into cold storage.
282
+ func NewPebbleDBDatabaseWithFreezer (file string , cache int , handles int , freezer string , namespace string , readonly bool ) (ethdb.Database , error ) {
283
+ kvdb , err := pebble .New (file , cache , handles , namespace , readonly )
284
+ if err != nil {
285
+ return nil , err
286
+ }
287
+ frdb , err := NewDatabaseWithFreezer (kvdb , freezer , namespace , readonly )
288
+ if err != nil {
289
+ kvdb .Close ()
290
+ return nil , err
291
+ }
292
+ return frdb , nil
293
+ }
294
+
269
295
type counter uint64
270
296
271
297
func (c counter ) String () string {
0 commit comments