mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 09:42:19 +00:00
sharding: using eth leveldb, interface mismatch
Former-commit-id: 127630fadb68deff3418e499f303f7eab16e775f [formerly 20bf39d9d62f72857512b505cfac7e122002c4ab] Former-commit-id: d3baf1deac782fa9ee4bcceae658723b65d1b08d
This commit is contained in:
parent
8c58ffc333
commit
0f27660b18
@ -9,13 +9,14 @@ import (
|
||||
"github.com/micro/cli"
|
||||
)
|
||||
|
||||
// CreateShardDB initializes a shardDB that writes to local disk.
|
||||
func CreateShardDB(ctx *cli.Context, name string) (sharding.ShardBackend, error) {
|
||||
// NewShardDB initializes a shardDB that writes to local disk.
|
||||
func NewShardDB(ctx *cli.Context, name string) (sharding.ShardBackend, error) {
|
||||
|
||||
dataDir := ctx.GlobalString(utils.DataDir.Name)
|
||||
dataDir := ctx.GlobalString(utils.DataDirFlag.Name)
|
||||
path := filepath.Join(dataDir, name)
|
||||
|
||||
// Uses default cache and handles values.
|
||||
// TODO: fix interface.
|
||||
// TODO: allow these to be set based on cli context.
|
||||
// TODO: fix interface - lots of methods do not match.
|
||||
return ethdb.NewLDBDatabase(path, 16, 16)
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package notary
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/sharding"
|
||||
"github.com/ethereum/go-ethereum/sharding/database"
|
||||
"github.com/ethereum/go-ethereum/sharding/node"
|
||||
|
||||
cli "gopkg.in/urfave/cli.v1"
|
||||
@ -11,12 +13,20 @@ import (
|
||||
// in a sharded system. Must satisfy the Service interface defined in
|
||||
// sharding/service.go.
|
||||
type Notary struct {
|
||||
node node.Node
|
||||
node node.Node
|
||||
shardDB sharding.ShardBackend
|
||||
}
|
||||
|
||||
// NewNotary creates a new notary instance.
|
||||
func NewNotary(ctx *cli.Context, node node.Node) (*Notary, error) {
|
||||
return &Notary{node}, nil
|
||||
// Initializes a shardDB that writes to disk at /path/to/datadir/shardchaindata.
|
||||
// This DB can be used by the Notary service to create Shard struct
|
||||
// instances.
|
||||
shardDB, err := database.NewShardDB(node.Context(), "shardchaindata")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Notary{node, shardDB}, nil
|
||||
}
|
||||
|
||||
// Start the main routine for a notary.
|
||||
|
Loading…
Reference in New Issue
Block a user