add select_backend module
This commit is contained in:
parent
0487720769
commit
96b18cfce3
|
@ -0,0 +1,10 @@
|
|||
const nimbus_db_backend {.strdefine.} = "rocksdb"
|
||||
|
||||
when nimbus_db_backend == "sqlite":
|
||||
import ./backends/sqlite_backend as database_backend
|
||||
elif nimbus_db_backend == "rocksdb":
|
||||
import ./backends/rocksdb_backend as database_backend
|
||||
else:
|
||||
import ./backends/lmdb_backend as database_backend
|
||||
|
||||
export database_backend
|
|
@ -8,22 +8,13 @@
|
|||
# those terms.
|
||||
|
||||
import
|
||||
os, strutils, net, eth_common, db/[storage_types, db_chain],
|
||||
os, strutils, net, eth_common, db/[storage_types, db_chain, select_backend],
|
||||
asyncdispatch2, json_rpc/rpcserver, eth_keys, chronicles,
|
||||
eth_p2p, eth_p2p/rlpx_protocols/[eth_protocol, les_protocol],
|
||||
eth_p2p/blockchain_sync,
|
||||
config, genesis, rpc/[common, p2p, debug, whisper], p2p/chain,
|
||||
eth_trie/db
|
||||
|
||||
const nimbus_db_backend {.strdefine.} = "rocksdb"
|
||||
|
||||
when nimbus_db_backend == "sqlite":
|
||||
import ../nimbus/db/backends/sqlite_backend
|
||||
elif nimbus_db_backend == "rocksdb":
|
||||
import ../nimbus/db/backends/rocksdb_backend
|
||||
else:
|
||||
import ../nimbus/db/backends/lmdb_backend
|
||||
|
||||
## TODO:
|
||||
## * No IPv6 support
|
||||
## * No multiple bind addresses support
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
import
|
||||
json, os, eth_common, stint, chronicles, byteutils, nimcrypto, rlp,
|
||||
eth_trie/[db], ../nimbus/db/[db_chain, capturedb, storage_types],
|
||||
eth_trie/[db], ../nimbus/db/[db_chain, capturedb, storage_types, select_backend],
|
||||
../nimbus/[tracer, vm_types, config],
|
||||
../nimbus/p2p/chain
|
||||
|
||||
const nimbus_db_backend {.strdefine.} = "rocksdb"
|
||||
|
||||
when nimbus_db_backend == "sqlite":
|
||||
import ../nimbus/db/backends/sqlite_backend
|
||||
elif nimbus_db_backend == "rocksdb":
|
||||
import ../nimbus/db/backends/rocksdb_backend
|
||||
else:
|
||||
import ../nimbus/db/backends/lmdb_backend
|
||||
|
||||
proc putCanonicalHead(chainDB: BaseChainDB, header: BlockHeader) =
|
||||
var headerHash = rlpHash(header)
|
||||
chainDB.db.put(genericHashKey(headerHash).toOpenArray, rlp.encode(header))
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
import
|
||||
json, os, eth_common, stint, chronicles, byteutils, nimcrypto,
|
||||
eth_trie/[db], ../nimbus/db/[db_chain, capturedb],
|
||||
eth_trie/[db], ../nimbus/db/[db_chain, capturedb, select_backend],
|
||||
../nimbus/[tracer, vm_types, config]
|
||||
|
||||
const nimbus_db_backend {.strdefine.} = "rocksdb"
|
||||
|
||||
when nimbus_db_backend == "sqlite":
|
||||
import ../nimbus/db/backends/sqlite_backend
|
||||
elif nimbus_db_backend == "rocksdb":
|
||||
import ../nimbus/db/backends/rocksdb_backend
|
||||
else:
|
||||
import ../nimbus/db/backends/lmdb_backend
|
||||
|
||||
proc dumpTest(chainDB: BaseChainDB, blockNumber: int) =
|
||||
let
|
||||
blockNumber = blockNumber.u256
|
||||
|
|
Loading…
Reference in New Issue