mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-08 16:43:10 +00:00
whats up with windows + questionable + generics
This commit is contained in:
parent
eba40334b8
commit
e653364311
@ -210,7 +210,7 @@ proc query*[K,V](
|
|||||||
let env = FsQueryEnv[K,V](self: self, basePath: DataBuffer.new(basePath))
|
let env = FsQueryEnv[K,V](self: self, basePath: DataBuffer.new(basePath))
|
||||||
success FsQueryHandle[K, V](query: query, env: env)
|
success FsQueryHandle[K, V](query: query, env: env)
|
||||||
|
|
||||||
proc close*[K,V](handle: var DbQueryHandle[K,V,FsQueryEnv[K,V]]) =
|
proc close*[K,V](handle: var FsQueryHandle[K,V]) =
|
||||||
if not handle.closed:
|
if not handle.closed:
|
||||||
handle.closed = true
|
handle.closed = true
|
||||||
|
|
||||||
|
|||||||
@ -167,7 +167,7 @@ proc close*[K,V](handle: var SqQueryHandle[K,V]) =
|
|||||||
discard sqlite3_clear_bindings(handle.env)
|
discard sqlite3_clear_bindings(handle.env)
|
||||||
handle.env.dispose()
|
handle.env.dispose()
|
||||||
|
|
||||||
iterator queyIter*[K, V](
|
iterator queryIter*[K, V](
|
||||||
handle: var SqQueryHandle[K, V]
|
handle: var SqQueryHandle[K, V]
|
||||||
): ?!DbQueryResponse[K, V] =
|
): ?!DbQueryResponse[K, V] =
|
||||||
while not handle.cancel:
|
while not handle.cancel:
|
||||||
|
|||||||
@ -152,7 +152,7 @@ method has*[BT](self: ThreadDatastore[BT],
|
|||||||
self.tp.spawn hasTask(ctx, ds, key)
|
self.tp.spawn hasTask(ctx, ds, key)
|
||||||
return ctx[].res.toRes(v => v)
|
return ctx[].res.toRes(v => v)
|
||||||
|
|
||||||
method deleteTask[T, DB](ctx: TaskCtx[T], ds: DB;
|
proc deleteTask[T, DB](ctx: TaskCtx[T], ds: DB;
|
||||||
key: KeyId) {.gcsafe.} =
|
key: KeyId) {.gcsafe.} =
|
||||||
## run backend command
|
## run backend command
|
||||||
executeTask(ctx):
|
executeTask(ctx):
|
||||||
@ -217,7 +217,7 @@ method put*[DB](
|
|||||||
return success()
|
return success()
|
||||||
|
|
||||||
|
|
||||||
method getTask[DB](ctx: TaskCtx[DataBuffer], ds: DB;
|
proc getTask[DB](ctx: TaskCtx[DataBuffer], ds: DB;
|
||||||
key: KeyId) {.gcsafe, nimcall.} =
|
key: KeyId) {.gcsafe, nimcall.} =
|
||||||
## run backend command
|
## run backend command
|
||||||
executeTask(ctx):
|
executeTask(ctx):
|
||||||
@ -246,11 +246,11 @@ method close*[BT](self: ThreadDatastore[BT]): Future[?!void] {.async.} =
|
|||||||
type
|
type
|
||||||
QResult = DbQueryResponse[KeyId, DataBuffer]
|
QResult = DbQueryResponse[KeyId, DataBuffer]
|
||||||
|
|
||||||
method queryTask[DB](
|
proc queryTask[DB](
|
||||||
ctx: TaskCtx[QResult],
|
ctx: TaskCtx[QResult],
|
||||||
ds: DB,
|
ds: DB,
|
||||||
query: DbQuery[KeyId],
|
query: DbQuery[KeyId],
|
||||||
) {.gcsafe, nimcall.} =
|
) =
|
||||||
## run query command
|
## run query command
|
||||||
mixin queryIter
|
mixin queryIter
|
||||||
executeTask(ctx):
|
executeTask(ctx):
|
||||||
@ -272,7 +272,7 @@ method queryTask[DB](
|
|||||||
var handle = handleRes.get()
|
var handle = handleRes.get()
|
||||||
static:
|
static:
|
||||||
echo "HANDLE: ", typeof(handle)
|
echo "HANDLE: ", typeof(handle)
|
||||||
for item in handle.queyIter():
|
for item in handle.queryIter():
|
||||||
# wait for next request from async thread
|
# wait for next request from async thread
|
||||||
|
|
||||||
if ctx[].cancelled:
|
if ctx[].cancelled:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user