mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-08 00:23:10 +00:00
rename sharedds to threadproxyds
This commit is contained in:
parent
ae584e900a
commit
0f32ea2344
@ -22,30 +22,30 @@ export key, query
|
|||||||
push: {.upraises: [].}
|
push: {.upraises: [].}
|
||||||
|
|
||||||
type
|
type
|
||||||
SharedDatastore* = ref object of Datastore
|
ThreadProxyDatastore* = ref object of Datastore
|
||||||
# stores*: Table[Key, SharedDatastore]
|
# stores*: Table[Key, ThreadProxyDatastore]
|
||||||
tds: ThreadDatastorePtr
|
tds: ThreadDatastorePtr
|
||||||
|
|
||||||
method has*(
|
method has*(
|
||||||
self: SharedDatastore,
|
self: ThreadProxyDatastore,
|
||||||
key: Key
|
key: Key
|
||||||
): Future[?!bool] {.async.} =
|
): Future[?!bool] {.async.} =
|
||||||
return success(true)
|
return success(true)
|
||||||
|
|
||||||
method delete*(
|
method delete*(
|
||||||
self: SharedDatastore,
|
self: ThreadProxyDatastore,
|
||||||
key: Key
|
key: Key
|
||||||
): Future[?!void] {.async.} =
|
): Future[?!void] {.async.} =
|
||||||
return success()
|
return success()
|
||||||
|
|
||||||
method delete*(
|
method delete*(
|
||||||
self: SharedDatastore,
|
self: ThreadProxyDatastore,
|
||||||
keys: seq[Key]
|
keys: seq[Key]
|
||||||
): Future[?!void] {.async.} =
|
): Future[?!void] {.async.} =
|
||||||
return success()
|
return success()
|
||||||
|
|
||||||
method get*(
|
method get*(
|
||||||
self: SharedDatastore,
|
self: ThreadProxyDatastore,
|
||||||
key: Key
|
key: Key
|
||||||
): Future[?!seq[byte]] {.async.} =
|
): Future[?!seq[byte]] {.async.} =
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ method get*(
|
|||||||
return success(data)
|
return success(data)
|
||||||
|
|
||||||
method put*(
|
method put*(
|
||||||
self: SharedDatastore,
|
self: ThreadProxyDatastore,
|
||||||
key: Key,
|
key: Key,
|
||||||
data: seq[byte]
|
data: seq[byte]
|
||||||
): Future[?!void] {.async.} =
|
): Future[?!void] {.async.} =
|
||||||
@ -84,13 +84,13 @@ method put*(
|
|||||||
return success()
|
return success()
|
||||||
|
|
||||||
method put*(
|
method put*(
|
||||||
self: SharedDatastore,
|
self: ThreadProxyDatastore,
|
||||||
batch: seq[BatchEntry]
|
batch: seq[BatchEntry]
|
||||||
): Future[?!void] {.async.} =
|
): Future[?!void] {.async.} =
|
||||||
raiseAssert("Not implemented!")
|
raiseAssert("Not implemented!")
|
||||||
|
|
||||||
method close*(
|
method close*(
|
||||||
self: SharedDatastore
|
self: ThreadProxyDatastore
|
||||||
): Future[?!void] {.async.} =
|
): Future[?!void] {.async.} =
|
||||||
# TODO: how to handle failed close?
|
# TODO: how to handle failed close?
|
||||||
echo "ThreadDatastore: FREE: "
|
echo "ThreadDatastore: FREE: "
|
||||||
@ -106,9 +106,9 @@ method close*(
|
|||||||
|
|
||||||
proc newSharedDataStore*(
|
proc newSharedDataStore*(
|
||||||
ds: Datastore,
|
ds: Datastore,
|
||||||
): ?!SharedDatastore =
|
): ?!ThreadProxyDatastore =
|
||||||
|
|
||||||
var self = SharedDatastore()
|
var self = ThreadProxyDatastore()
|
||||||
|
|
||||||
let value = newSharedPtr(ThreadDatastore)
|
let value = newSharedPtr(ThreadDatastore)
|
||||||
echo "\nnewDataStore: threadId:", getThreadId()
|
echo "\nnewDataStore: threadId:", getThreadId()
|
||||||
@ -9,18 +9,18 @@ import pkg/stew/results
|
|||||||
import pkg/stew/byteutils
|
import pkg/stew/byteutils
|
||||||
|
|
||||||
import pkg/datastore/memoryds
|
import pkg/datastore/memoryds
|
||||||
import pkg/datastore/sharedds
|
import pkg/datastore/threadproxyds
|
||||||
|
|
||||||
import ./dscommontests
|
import ./dscommontests
|
||||||
import ./querycommontests
|
import ./querycommontests
|
||||||
|
|
||||||
import pretty
|
import pretty
|
||||||
|
|
||||||
suite "Test Basic SharedDatastore":
|
suite "Test Basic ThreadProxyDatastore":
|
||||||
var
|
var
|
||||||
sds: SharedDatastore
|
sds: ThreadProxyDatastore
|
||||||
mem: MemoryDatastore
|
mem: MemoryDatastore
|
||||||
res: SharedDatastore
|
res: ThreadProxyDatastore
|
||||||
key1: Key
|
key1: Key
|
||||||
data: seq[byte]
|
data: seq[byte]
|
||||||
|
|
||||||
@ -50,11 +50,11 @@ suite "Test Basic SharedDatastore":
|
|||||||
# res3.cancel()
|
# res3.cancel()
|
||||||
# # print "res3: ", res3
|
# # print "res3: ", res3
|
||||||
|
|
||||||
suite "Test Basic SharedDatastore":
|
suite "Test Basic ThreadProxyDatastore":
|
||||||
|
|
||||||
var
|
var
|
||||||
memStore: MemoryDatastore
|
memStore: MemoryDatastore
|
||||||
ds: SharedDatastore
|
ds: ThreadProxyDatastore
|
||||||
key = Key.init("/a/b").tryGet()
|
key = Key.init("/a/b").tryGet()
|
||||||
bytes = "some bytes".toBytes
|
bytes = "some bytes".toBytes
|
||||||
otherBytes = "some other bytes".toBytes
|
otherBytes = "some other bytes".toBytes
|
||||||
Loading…
x
Reference in New Issue
Block a user