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