mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-03 14:13:09 +00:00
result types
This commit is contained in:
parent
e75081f832
commit
c1f5d43775
@ -159,6 +159,7 @@ method has*(self: ThreadDatastore,
|
||||
let key = KeyId.new key.id()
|
||||
dispatchTask[bool](self, signal):
|
||||
self.tp.spawn hasTask(ctx, ds, key)
|
||||
return ctx[].res.toRes(v => v)
|
||||
|
||||
proc deleteTask[T, DB](ctx: TaskCtx[T], ds: DB;
|
||||
key: KeyId) {.gcsafe.} =
|
||||
@ -175,6 +176,7 @@ method delete*(self: ThreadDatastore,
|
||||
let key = KeyId.new key.id()
|
||||
dispatchTask[void](self, signal):
|
||||
self.tp.spawn deleteTask(ctx, ds, key)
|
||||
return ctx[].res.toRes()
|
||||
|
||||
method delete*(self: ThreadDatastore,
|
||||
keys: seq[Key]): Future[?!void] {.async.} =
|
||||
|
||||
@ -58,29 +58,29 @@ suite "Test Basic ThreadProxyDatastore":
|
||||
val &= char(c)
|
||||
echo "get res2: ", $val
|
||||
|
||||
# suite "Test Basic ThreadDatastore with SQLite":
|
||||
suite "Test Basic ThreadDatastore with SQLite":
|
||||
|
||||
# var
|
||||
# sqlStore: SQLiteBackend[KeyId,DataBuffer]
|
||||
# ds: ThreadDatastore
|
||||
# taskPool: Taskpool
|
||||
# key = Key.init("/a/b").tryGet()
|
||||
# bytes = "some bytes".toBytes
|
||||
# otherBytes = "some other bytes".toBytes
|
||||
var
|
||||
sqlStore: SQLiteBackend[KeyId,DataBuffer]
|
||||
ds: ThreadDatastore
|
||||
taskPool: Taskpool
|
||||
key = Key.init("/a/b").tryGet()
|
||||
bytes = "some bytes".toBytes
|
||||
otherBytes = "some other bytes".toBytes
|
||||
|
||||
# setupAll:
|
||||
# sqlStore = newSQLiteBackend[KeyId, DataBuffer](Memory).tryGet()
|
||||
# taskPool = Taskpool.new(NumThreads)
|
||||
# ds = ThreadDatastore.new(sqlStore, tp = taskPool).tryGet()
|
||||
setupAll:
|
||||
sqlStore = newSQLiteBackend[KeyId, DataBuffer](Memory).tryGet()
|
||||
taskPool = Taskpool.new(NumThreads)
|
||||
ds = ThreadDatastore.new(sqlStore, tp = taskPool).tryGet()
|
||||
|
||||
# teardown:
|
||||
# GC_fullCollect()
|
||||
teardown:
|
||||
GC_fullCollect()
|
||||
|
||||
# teardownAll:
|
||||
# (await ds.close()).tryGet()
|
||||
# taskPool.shutdown()
|
||||
teardownAll:
|
||||
(await ds.close()).tryGet()
|
||||
taskPool.shutdown()
|
||||
|
||||
# basicStoreTests(ds, key, bytes, otherBytes)
|
||||
basicStoreTests(ds, key, bytes, otherBytes)
|
||||
|
||||
# suite "Test Query ThreadDatastore with SQLite":
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user