mirror of
https://github.com/logos-storage/apatheia.git
synced 2026-01-02 13:03:11 +00:00
updates
This commit is contained in:
parent
8413c39058
commit
22566c40ff
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
*
|
*
|
||||||
!*/
|
!*/
|
||||||
!*.*
|
!*.*
|
||||||
.tool-versions
|
.tool-versions
|
||||||
|
nim.cfg
|
||||||
|
|||||||
@ -10,3 +10,4 @@ srcDir = "src"
|
|||||||
|
|
||||||
requires "chronos >= 4.0.0"
|
requires "chronos >= 4.0.0"
|
||||||
requires "threading"
|
requires "threading"
|
||||||
|
requires "taskpool"
|
||||||
|
|||||||
@ -32,9 +32,6 @@ iterator paramsIter*(params: NimNode): tuple[name, ntype: NimNode] =
|
|||||||
for j in 0 ..< arg.len-2:
|
for j in 0 ..< arg.len-2:
|
||||||
yield (arg[j], argType)
|
yield (arg[j], argType)
|
||||||
|
|
||||||
proc identPub*(name: string): NimNode =
|
|
||||||
result = nnkPostfix.newTree(newIdentNode("*"), ident name)
|
|
||||||
|
|
||||||
proc signalTuple*(sig: NimNode): NimNode =
|
proc signalTuple*(sig: NimNode): NimNode =
|
||||||
let otp = nnkEmpty.newTree()
|
let otp = nnkEmpty.newTree()
|
||||||
# echo "signalObjRaw:sig1: ", sig.treeRepr
|
# echo "signalObjRaw:sig1: ", sig.treeRepr
|
||||||
@ -120,6 +117,16 @@ proc mkParamsType*(paramsIdent, paramsType, params, genericParams: NimNode): Nim
|
|||||||
result[0][1] = genericParams.copyNimTree()
|
result[0][1] = genericParams.copyNimTree()
|
||||||
# echo "mkParamsType: ", genericParams.treeRepr
|
# echo "mkParamsType: ", genericParams.treeRepr
|
||||||
|
|
||||||
|
proc identPub*(name: string): NimNode =
|
||||||
|
result = nnkPostfix.newTree(newIdentNode("*"), ident name)
|
||||||
|
|
||||||
|
proc procIdentAppend*(id: NimNode, name: string): NimNode =
|
||||||
|
if id.kind == nnkPostfix:
|
||||||
|
echo "PROC ID: ", id.treeRepr
|
||||||
|
result = id
|
||||||
|
result[1] = ident(result[1].strVal & name)
|
||||||
|
else:
|
||||||
|
result = ident(result.strVal & name)
|
||||||
|
|
||||||
proc mkCall*(callName, params: NimNode): NimNode =
|
proc mkCall*(callName, params: NimNode): NimNode =
|
||||||
## Create local variables for each parameter in the actual RPC call proc
|
## Create local variables for each parameter in the actual RPC call proc
|
||||||
|
|||||||
@ -31,14 +31,17 @@ macro asyncTask*(p: untyped): untyped =
|
|||||||
for paramId, paramType in paramsIter(params):
|
for paramId, paramType in paramsIter(params):
|
||||||
echo "param: ", paramId, " tp: ", paramType.treeRepr
|
echo "param: ", paramId, " tp: ", paramType.treeRepr
|
||||||
asyncBody.add newCall("checkParamType", paramId)
|
asyncBody.add newCall("checkParamType", paramId)
|
||||||
|
let tcall = mkCall(ident name, params)
|
||||||
# echo "asyncTask:checks:\n", asyncBody.repr
|
# echo "asyncTask:checks:\n", asyncBody.repr
|
||||||
# let tcall = mkCall(ident"tester", params)
|
# echo "asyncTask:tcall: ", tcall.repr
|
||||||
|
|
||||||
|
|
||||||
echo "asyncTask:body:\n", body.repr
|
echo "asyncTask:body:\n", body.repr
|
||||||
let taskProc = mkProc(procId, params, body)
|
let tp = mkProc(procId.procIdentAppend("Tasklet"),
|
||||||
|
params, body)
|
||||||
|
|
||||||
result = newStmtList()
|
result = newStmtList()
|
||||||
result.add taskProc
|
result.add tp
|
||||||
echo "asyncTask:body:\n", result.repr
|
echo "asyncTask:body:\n", result.repr
|
||||||
# echo "asyncTask:body:\n", result.treeRepr
|
# echo "asyncTask:body:\n", result.treeRepr
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import apatheia/queues
|
import apatheia/tasks
|
||||||
|
|
||||||
test "can add":
|
test "can add":
|
||||||
check 10 == 10
|
check 10 == 10
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user