[build] update nim-datastore

also make changes to `codex/codex.nim` and tests for SQLiteStore re: changes in
nim-datastore

closes #178
This commit is contained in:
Michael Bradley, Jr 2022-08-08 16:42:05 -05:00 committed by Michael Bradley
parent 097a4cfd67
commit 5aa42541b3
3 changed files with 11 additions and 2 deletions

View File

@ -133,7 +133,15 @@ proc new*(T: type CodexServer, config: CodexConf): T =
wallet = WalletRef.new(EthPrivateKey.random()) wallet = WalletRef.new(EthPrivateKey.random())
network = BlockExcNetwork.new(switch) network = BlockExcNetwork.new(switch)
localStore = SQLiteStore.new(config.dataDir / "repo", cache = cache) repoDir = config.dataDir / "repo"
if io2.createPath(repoDir).isErr:
trace "Unable to create data directory for block store", dataDir = repoDir
raise (ref Defect)(
msg: "Unable to create data directory for block store: " & repoDir)
let
localStore = SQLiteStore.new(repoDir, cache = cache)
peerStore = PeerCtxStore.new() peerStore = PeerCtxStore.new()
pendingBlocks = PendingBlocksManager.new() pendingBlocks = PendingBlocksManager.new()
discovery = DiscoveryEngine.new(localStore, peerStore, network, blockDiscovery, pendingBlocks) discovery = DiscoveryEngine.new(localStore, peerStore, network, blockDiscovery, pendingBlocks)

View File

@ -38,6 +38,7 @@ proc runSuite(cache: bool) =
setup: setup:
removeDir(repoDir) removeDir(repoDir)
require(not dirExists(repoDir)) require(not dirExists(repoDir))
createDir(repoDir)
if cache: if cache:
store = SQLiteStore.new(repoDir) store = SQLiteStore.new(repoDir)

@ -1 +1 @@
Subproject commit d5d986c0140a46e957d9a88df40b7ce7dad424f3 Subproject commit 2769ce1de21e595e712fd1df7a195c34cd5d18de