mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 10:41:19 +00:00
52cc968c57
Former-commit-id: 806e44466e6484a0028fa39f364c2ee63e828983 [formerly 89d7697ddc25156265f8f49622a775c879e3bd88] Former-commit-id: 8cf56c2760f2b9fcf1121a94967276c2a34cae58
26 lines
745 B
Go
26 lines
745 B
Go
package database
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/ethereum/go-ethereum/ethdb"
|
|
)
|
|
|
|
// ShardBackend defines an interface for a shardDB's necessary method
|
|
// signatures.
|
|
type ShardBackend interface {
|
|
Get(k []byte) ([]byte, error)
|
|
Has(k []byte) (bool, error)
|
|
Put(k []byte, val []byte) error
|
|
Delete(k []byte) error
|
|
}
|
|
|
|
// NewShardDB initializes a shardDB that writes to local disk.
|
|
// TODO: make it return ShardBackend but modify interface methods.
|
|
func NewShardDB(dataDir string, name string) (ShardBackend, error) {
|
|
// Uses default cache and handles values.
|
|
// TODO: allow these to be set based on cli context.
|
|
// TODO: fix interface - lots of methods do not match.
|
|
return ethdb.NewLDBDatabase(filepath.Join(dataDir, name), 16, 16)
|
|
}
|