2018-06-05 21:28:57 +00:00
|
|
|
// Package database provides several constructs including a simple in-memory database.
|
|
|
|
// This should not be used for production, but would be a helpful interim
|
|
|
|
// solution for development.
|
2018-05-22 18:36:55 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/ethdb"
|
|
|
|
)
|
|
|
|
|
2018-05-22 18:49:59 +00:00
|
|
|
// NewShardDB initializes a shardDB that writes to local disk.
|
2018-06-08 21:45:26 +00:00
|
|
|
func NewShardDB(dataDir string, name string) (ethdb.Database, error) {
|
2018-05-22 18:36:55 +00:00
|
|
|
// Uses default cache and handles values.
|
2018-05-25 15:06:39 +00:00
|
|
|
// TODO: allow these arguments to be set based on cli context.
|
2018-05-24 23:36:20 +00:00
|
|
|
return ethdb.NewLDBDatabase(filepath.Join(dataDir, name), 16, 16)
|
2018-05-22 18:36:55 +00:00
|
|
|
}
|