various cleanup

This commit is contained in:
Jaremy Creechley 2023-08-29 13:14:33 -07:00
parent ddaaec3fa6
commit 02956c6fb9
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
4 changed files with 6 additions and 14 deletions

View File

@ -70,7 +70,6 @@ method put*(
let dk = KeyBuffer.new(key)
let dv = ValueBuffer.new(data)
echo "MemoryDatastore:put: ", key, " => ", data.repr
self.store[dk] = dv
return success()

View File

@ -136,11 +136,8 @@ proc put*(
key: Key,
data: seq[byte]
) =
echo "thrfrontend:put: "
let bkey = StringBuffer.new(key.id())
let bval = DataBuffer.new(data)
print "bkey: ", bkey
print "bval: ", bval
tds[].tp.spawn putTask(ret, tds, bkey, bval)

View File

@ -37,10 +37,10 @@ method has*(
has(ret, self.tds, key)
await wait(ret[].signal)
finally:
echo "closing signal"
# echo "closing signal"
ret[].signal.close()
echo "\nSharedDataStore:has:value: ", ret[].repr
# echo "\nSharedDataStore:has:value: ", ret[].repr
return success(ret[].value)
method delete*(
@ -55,10 +55,10 @@ method delete*(
delete(ret, self.tds, key)
await wait(ret[].signal)
finally:
echo "closing signal"
# echo "closing signal"
ret[].signal.close()
echo "\nSharedDataStore:put:value: ", ret[].repr
# echo "\nSharedDataStore:put:value: ", ret[].repr
return success()
method delete*(
@ -84,10 +84,9 @@ method get*(
get(ret, self.tds, key)
await wait(ret[].signal)
finally:
echo "closing signal"
ret[].signal.close()
print "\nSharedDataStore:put:value: ", ret[]
# print "\nSharedDataStore:put:value: ", ret[]
let data = ret[].value.toSeq(byte)
return success(data)
@ -100,15 +99,13 @@ method put*(
without ret =? newThreadResult(void), err:
return failure(err)
echo "res: ", ret
try:
put(ret, self.tds, key, data)
await wait(ret[].signal)
finally:
echo "closing signal"
ret[].signal.close()
echo "\nSharedDataStore:put:value: ", ret[].repr
# echo "\nSharedDataStore:put:value: ", ret[].repr
return success()
method put*(
@ -126,7 +123,6 @@ method close*(
self: ThreadProxyDatastore
): Future[?!void] {.async.} =
# TODO: how to handle failed close?
echo "ThreadDatastore: FREE: "
result = success()
without res =? self.tds[].ds.close(), err: