mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-02 13:43:11 +00:00
it runs!
This commit is contained in:
parent
8a36bbbdb2
commit
13dc326494
@ -11,7 +11,7 @@ type
|
||||
delete*: proc(self: SharedPtr[T], key: KeyBuffer): ?!void {.nimcall, gcsafe, raises: [].}
|
||||
get*: proc(self: SharedPtr[T], key: KeyBuffer): ?!ValueBuffer {.nimcall, gcsafe, raises: [].}
|
||||
put*: proc(self: SharedPtr[T], key: KeyBuffer, data: ValueBuffer): ?!void {.nimcall, gcsafe, raises: [].}
|
||||
close*: proc(self: SharedPtr[T]): ?!void {.gcsafe, raises: [].}
|
||||
close*: proc(self: SharedPtr[T]): ?!void {.nimcall, gcsafe, raises: [].}
|
||||
ids*: SharedPtr[T]
|
||||
|
||||
proc has*[T](self: Datastore2[T], key: KeyBuffer): ?!bool =
|
||||
@ -23,6 +23,4 @@ proc get*[T](self: Datastore2[T], key: KeyBuffer): ?!ValueBuffer {.nimcall.} =
|
||||
proc put*[T](self: Datastore2[T], key: KeyBuffer, data: ValueBuffer): ?!void {.nimcall.} =
|
||||
self.put(self.ids, key, data)
|
||||
proc close*[T](self: Datastore2[T]): ?!void {.nimcall.} =
|
||||
echo "CLOSE: ", self
|
||||
echo "CLOSE: ", self.ids.repr
|
||||
self.close(self.ids)
|
||||
|
||||
@ -24,7 +24,7 @@ push: {.upraises: [].}
|
||||
type
|
||||
MemoryDatastore* = object
|
||||
lock*: Lock
|
||||
store*: SimpleTable[10_000]
|
||||
store*: SimpleTable[100]
|
||||
|
||||
proc has(self: SharedPtr[MemoryDatastore], key: KeyBuffer): ?!bool =
|
||||
|
||||
|
||||
@ -193,7 +193,7 @@ method close*[T](
|
||||
if self.tds[].tp != nil:
|
||||
## this can block... how to handle? maybe just leak?
|
||||
self.tds[].tp.shutdown()
|
||||
self[].tds[].tp = nil # ensure our sharedptr doesn't try and dealloc
|
||||
# self[].tds[].tp = nil # ensure our sharedptr doesn't try and dealloc
|
||||
|
||||
self.tds.release()
|
||||
echo "close done"
|
||||
|
||||
@ -30,10 +30,10 @@ proc testThreadProxy() =
|
||||
key1 = Key.init("/a").tryGet
|
||||
data = "value for 1".toBytes()
|
||||
|
||||
# teardownAll:
|
||||
# let res = await sds.close()
|
||||
# res.get()
|
||||
# echo "teardown done"
|
||||
teardownAll:
|
||||
let res = await sds.close()
|
||||
res.get()
|
||||
echo "teardown done"
|
||||
|
||||
test "check put":
|
||||
# echo "\n\n=== put ==="
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user