mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-05 07:03:12 +00:00
add memory (test) ds
This commit is contained in:
parent
a7f6794f7e
commit
23423e52a9
@ -59,7 +59,7 @@ method get*(
|
||||
let dk = KeyBuffer.new(key)
|
||||
echo "getting: ", key
|
||||
for k, v in self.store.pairs():
|
||||
print "get: ", k.toString()
|
||||
print "get: ", k.toString(), " v: ", v.toString().repr
|
||||
|
||||
if self.store.hasKey(dk):
|
||||
let res = self.store[dk]
|
||||
|
||||
@ -43,8 +43,8 @@ proc thread1(val: int) {.thread.} =
|
||||
var myBytes = DataBuffer.new(@"hello world")
|
||||
myBytes2 = myBytes
|
||||
|
||||
echo "thread1: sending: ", myBytes, " cnt: ", myBytes.unsafeGetAtomicCount()
|
||||
echo "mybytes2: ", myBytes2, " cnt: ", myBytes2.unsafeGetAtomicCount()
|
||||
echo "thread1: sending: ", myBytes
|
||||
echo "mybytes2: ", myBytes2
|
||||
|
||||
shareVal = myBytes
|
||||
echo "thread1: sent, left over: ", $myBytes
|
||||
@ -60,7 +60,7 @@ proc thread2(val: int) {.thread.} =
|
||||
wait(cond, lock)
|
||||
echo "thread2: receiving "
|
||||
let msg: DataBuffer = shareVal
|
||||
echo "thread2: received: ", msg, " cnt: ", msg.unsafeGetAtomicCount()
|
||||
echo "thread2: received: ", msg
|
||||
check msg.toSeq(char) == @"hello world"
|
||||
# os.sleep(100)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user