erigon-pulse/consensus/db/db.go
Alex Sharov 0be3044b7e
rename (#1978)
* rename

* rename "make grpc"

* rename "abi bindings templates"

* rename "abi bindings templates"
2021-05-20 19:25:53 +01:00

32 lines
532 B
Go

package db
import (
"github.com/ledgerwatch/erigon/ethdb"
)
func OpenDatabase(path string, inmem bool, mdbx bool) *ethdb.ObjectDatabase {
return ethdb.NewObjectDatabase(openKV(path, inmem, mdbx))
}
func openKV(path string, inmem bool, mdbx bool) ethdb.RwKV {
if mdbx {
opts := ethdb.NewMDBX()
if inmem {
opts = opts.InMem()
} else {
opts = opts.Path(path)
}
return opts.MustOpen()
}
opts := ethdb.NewLMDB()
if inmem {
opts = opts.InMem()
} else {
opts = opts.Path(path)
}
return opts.MustOpen()
}