2020-04-29 12:40:33 -05:00
|
|
|
// Package db defines the ability to create a new database
|
2021-06-26 14:00:33 -05:00
|
|
|
// for an Ethereum Beacon Node.
|
2018-10-06 02:14:50 +09:00
|
|
|
package db
|
|
|
|
|
2020-03-30 15:10:45 -07:00
|
|
|
import (
|
2020-12-15 14:07:01 -08:00
|
|
|
"context"
|
|
|
|
|
2020-03-30 15:10:45 -07:00
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/db/kv"
|
|
|
|
)
|
2019-08-09 14:17:18 -05:00
|
|
|
|
2019-08-14 11:48:28 -07:00
|
|
|
// NewDB initializes a new DB.
|
2021-02-15 14:29:47 -06:00
|
|
|
func NewDB(ctx context.Context, dirPath string, config *kv.Config) (Database, error) {
|
|
|
|
return kv.NewKVStore(ctx, dirPath, config)
|
2019-08-14 11:48:28 -07:00
|
|
|
}
|
2021-04-23 12:06:13 -05:00
|
|
|
|
2021-04-30 15:37:38 -05:00
|
|
|
// NewDBFilename uses the KVStoreDatafilePath so that if this layer of
|
|
|
|
// indirection between db.NewDB->kv.NewKVStore ever changes, it will be easy to remember
|
|
|
|
// to also change this filename indirection at the same time.
|
|
|
|
func NewDBFilename(dirPath string) string {
|
|
|
|
return kv.KVStoreDatafilePath(dirPath)
|
|
|
|
}
|