plumbing values

This commit is contained in:
Jaremy Creechley 2023-08-24 18:06:02 -07:00
parent 221bfb7433
commit 909c676c26
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 3 additions and 21 deletions

View File

@ -23,42 +23,24 @@ method has*(
self: SharedDatastore,
key: Key
): Future[?!bool] {.async.} =
# without mounted =? self.dispatch(key):
# return failure "No mounted datastore found"
# return (await mounted.store.store.has(mounted.relative))
return success(true)
method delete*(
self: SharedDatastore,
key: Key
): Future[?!void] {.async.} =
# without mounted =? self.dispatch(key), error:
# return failure(error)
# return (await mounted.store.store.delete(mounted.relative))
return success()
method delete*(
self: SharedDatastore,
keys: seq[Key]
): Future[?!void] {.async.} =
# for key in keys:
# if err =? (await self.delete(key)).errorOption:
# return failure err
return success()
method get*(
self: SharedDatastore,
key: Key
): Future[?!seq[byte]] {.async.} =
# without mounted =? self.dispatch(key), error:
# return failure(error)
# return await mounted.store.store.get(mounted.relative)
return success(newSeq[byte]())
method put*(

View File

@ -78,18 +78,18 @@ proc put*(
proc close*(
self: ThreadDatastore,
signal: ThreadSignalPtr,
): Result[void, CatchableErrorBuffer] =
): TResult[void] =
try:
self[].tp.shutdown()
return ok()
except Exception as exc:
return err(exc.toBuffer())
return TResult[void].new()
func new*[S: ref Datastore](
T: typedesc[ThreadDatastore],
signal: ThreadSignalPtr,
backend: ThreadBackend,
): Result[ThreadDatastore, CatchableErrorBuffer] =
): TResult[ThreadDatastore] =
var self = T()
self.tp = Taskpool.new(num_threads = 1) ##\