plumbing values

This commit is contained in:
Jaremy Creechley 2023-08-24 18:06:02 -07:00 committed by Dmitriy Ryajov
parent 5ef4196e51
commit 3bde00d111
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
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) ##\