result types

This commit is contained in:
Jaremy Creechley 2023-09-26 17:30:20 -07:00
parent b8dad8bb60
commit 1aec1a460d
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300

View File

@ -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.} =