mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-05 23:23:10 +00:00
plumbing values
This commit is contained in:
parent
5ef4196e51
commit
3bde00d111
@ -23,42 +23,24 @@ method has*(
|
|||||||
self: SharedDatastore,
|
self: SharedDatastore,
|
||||||
key: Key
|
key: Key
|
||||||
): Future[?!bool] {.async.} =
|
): 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)
|
return success(true)
|
||||||
|
|
||||||
method delete*(
|
method delete*(
|
||||||
self: SharedDatastore,
|
self: SharedDatastore,
|
||||||
key: Key
|
key: Key
|
||||||
): Future[?!void] {.async.} =
|
): Future[?!void] {.async.} =
|
||||||
|
|
||||||
# without mounted =? self.dispatch(key), error:
|
|
||||||
# return failure(error)
|
|
||||||
# return (await mounted.store.store.delete(mounted.relative))
|
|
||||||
return success()
|
return success()
|
||||||
|
|
||||||
method delete*(
|
method delete*(
|
||||||
self: SharedDatastore,
|
self: SharedDatastore,
|
||||||
keys: seq[Key]
|
keys: seq[Key]
|
||||||
): Future[?!void] {.async.} =
|
): Future[?!void] {.async.} =
|
||||||
|
|
||||||
# for key in keys:
|
|
||||||
# if err =? (await self.delete(key)).errorOption:
|
|
||||||
# return failure err
|
|
||||||
|
|
||||||
return success()
|
return success()
|
||||||
|
|
||||||
method get*(
|
method get*(
|
||||||
self: SharedDatastore,
|
self: SharedDatastore,
|
||||||
key: Key
|
key: Key
|
||||||
): Future[?!seq[byte]] {.async.} =
|
): 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]())
|
return success(newSeq[byte]())
|
||||||
|
|
||||||
method put*(
|
method put*(
|
||||||
|
|||||||
@ -78,18 +78,18 @@ proc put*(
|
|||||||
proc close*(
|
proc close*(
|
||||||
self: ThreadDatastore,
|
self: ThreadDatastore,
|
||||||
signal: ThreadSignalPtr,
|
signal: ThreadSignalPtr,
|
||||||
): Result[void, CatchableErrorBuffer] =
|
): TResult[void] =
|
||||||
try:
|
try:
|
||||||
self[].tp.shutdown()
|
self[].tp.shutdown()
|
||||||
return ok()
|
return ok()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
return err(exc.toBuffer())
|
return TResult[void].new()
|
||||||
|
|
||||||
func new*[S: ref Datastore](
|
func new*[S: ref Datastore](
|
||||||
T: typedesc[ThreadDatastore],
|
T: typedesc[ThreadDatastore],
|
||||||
signal: ThreadSignalPtr,
|
signal: ThreadSignalPtr,
|
||||||
backend: ThreadBackend,
|
backend: ThreadBackend,
|
||||||
): Result[ThreadDatastore, CatchableErrorBuffer] =
|
): TResult[ThreadDatastore] =
|
||||||
|
|
||||||
var self = T()
|
var self = T()
|
||||||
self.tp = Taskpool.new(num_threads = 1) ##\
|
self.tp = Taskpool.new(num_threads = 1) ##\
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user