mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-03 22:23:10 +00:00
fixes
This commit is contained in:
parent
8644cbc9dc
commit
567e0d7003
@ -22,10 +22,6 @@ type
|
||||
# stores*: Table[Key, SharedDatastore]
|
||||
tds: ThreadDatastorePtr
|
||||
|
||||
template newSignal(): auto =
|
||||
ThreadSignalPtr.new().valueOr:
|
||||
return failure newException(DatastoreError, "error creating signal")
|
||||
|
||||
method has*(
|
||||
self: SharedDatastore,
|
||||
key: Key
|
||||
@ -78,13 +74,14 @@ method close*(
|
||||
proc newSharedDataStore*(
|
||||
# T: typedesc[SharedDatastore],
|
||||
backend: ThreadBackend,
|
||||
): ?!SharedDatastore =
|
||||
): Future[?!SharedDatastore] {.async.} =
|
||||
|
||||
var
|
||||
self = SharedDatastore()
|
||||
res = newThreadResult(ThreadDatastorePtr)
|
||||
|
||||
res[].signal = newSignal()
|
||||
res[].signal = ThreadSignalPtr.new().valueOr:
|
||||
return failure newException(DatastoreError, "error creating signal")
|
||||
res.createThreadDatastore(backend)
|
||||
|
||||
await wait(res[].signal)
|
||||
|
||||
@ -23,7 +23,7 @@ type
|
||||
Success
|
||||
Error
|
||||
|
||||
ThreadResult*[T: DataBuffer | void] = object
|
||||
ThreadResult*[T: DataBuffer | void | ThreadDatastorePtr] = object
|
||||
state*: ThreadResultKind
|
||||
signal*: ThreadSignalPtr
|
||||
value*: T
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user