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
b8dad8bb60
commit
1aec1a460d
@ -136,6 +136,7 @@ template dispatchTask[T](self: ThreadDatastore,
|
||||
let ctx {.inject.} = newSharedPtr(TaskCtxObj[T](signal: signal))
|
||||
dispatchTaskWrap[T](self, signal, blk)
|
||||
|
||||
|
||||
proc hasTask[T, DB](ctx: TaskCtx[T], ds: DB, key: KeyId) {.gcsafe.} =
|
||||
## run backend command
|
||||
executeTask(ctx):
|
||||
@ -152,6 +153,7 @@ method has*(self: ThreadDatastore,
|
||||
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.} =
|
||||
## run backend command
|
||||
@ -208,6 +210,9 @@ method put*(
|
||||
for entry in batch:
|
||||
if err =? (await self.put(entry.key, entry.data)).errorOption:
|
||||
return failure err
|
||||
|
||||
return success()
|
||||
|
||||
|
||||
proc getTask[DB](ctx: TaskCtx[DataBuffer], ds: DB;
|
||||
key: KeyId) {.gcsafe, nimcall.} =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user