adding quick and dirty io thread integration

This commit is contained in:
Dmitriy Ryajov 2023-09-15 17:00:33 -06:00
parent 13de6dc500
commit c161f0ad40
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
3 changed files with 16 additions and 5 deletions

3
.gitmodules vendored
View File

@ -193,3 +193,6 @@
[submodule "vendor/npeg"]
path = vendor/npeg
url = https://github.com/zevv/npeg
[submodule "vendor/threading"]
path = vendor/threading
url = https://github.com/nim-lang/threading.git

View File

@ -216,8 +216,9 @@ proc new*(
msg: "Unable to create discovery directory for block store: " & discoveryDir)
let
ioTp = ThreadedPool.new(200) # Some reasonable number of threads here
discoveryStore = Datastore(
SQLiteDatastore.new(config.dataDir / CodexDhtProvidersNamespace)
ThreadDatastore(ds = SQLiteDatastore.new(config.dataDir / CodexDhtProvidersNamespace), tp = ioTp)
.expect("Should create discovery datastore!"))
discovery = Discovery.new(
@ -232,15 +233,21 @@ proc new*(
network = BlockExcNetwork.new(switch)
repoData = case config.repoKind
of repoFS: Datastore(FSDatastore.new($config.dataDir, depth = 5)
of repoFS: Datastore(ThreadDatastore(
ds = FSDatastore.new($config.dataDir, depth = 5),
tp = ioTp,
withLocks = true)
.expect("Should create repo file data store!"))
of repoSQLite: Datastore(SQLiteDatastore.new($config.dataDir)
of repoSQLite: Datastore(ThreadDatastore(
ds = SQLiteDatastore.new($config.dataDir),
ioTp = ioTp)
.expect("Should create repo SQLite data store!"))
repoStore = RepoStore.new(
repoDs = repoData,
metaDs = SQLiteDatastore.new(config.dataDir / CodexMetaNamespace)
.expect("Should create meta data store!"),
metaDs = ThreadDatastore(
ds = SQLiteDatastore.new(config.dataDir / CodexMetaNamespace),
tp = ioTp).expect("Should create meta data store!"),
quotaMaxBytes = config.storageQuota.uint,
blockTtl = config.blockTtl)

1
vendor/threading vendored Submodule

@ -0,0 +1 @@
Subproject commit bcc284991ba928d1ed299a81a93b7113cc7de04f