mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 10:41:19 +00:00
aa8734ea56
Former-commit-id: 979b3f3f7424ed9c2855f37acfbb36e1cb05bb3a [formerly 638fb7ddd3e39f136d5d1eb32ddc01d23bac5729] Former-commit-id: 47be397ed0173b73eaeb2ffb7b194689e76be7a5
24 lines
632 B
Go
24 lines
632 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.
|
|
func NewShardDB(dataDir string, name string) (ShardBackend, error) {
|
|
// Uses default cache and handles values.
|
|
// TODO: allow these arguments to be set based on cli context.
|
|
return ethdb.NewLDBDatabase(filepath.Join(dataDir, name), 16, 16)
|
|
}
|