mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-04 22:53:08 +00:00
plumbing values
This commit is contained in:
parent
5ef4196e51
commit
3bde00d111
@ -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*(
|
||||
|
||||
@ -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) ##\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user