mirror of
https://github.com/logos-storage/apatheia.git
synced 2026-01-04 05:53:11 +00:00
cleanup
This commit is contained in:
parent
542e4f77f2
commit
ee418a09d3
@ -7,12 +7,12 @@ export jobs
|
|||||||
|
|
||||||
# TODO: make these do something useful or remove them
|
# TODO: make these do something useful or remove them
|
||||||
|
|
||||||
template checkParamType*(obj: object): auto =
|
template convertParamType*[T](obj: OpenArrayHolder[T]): auto =
|
||||||
# for name, field in obj.fieldPairs():
|
static:
|
||||||
# echo "field name: ", name
|
echo "CONVERTPARAMTYPE:: ", $typeof(obj)
|
||||||
obj
|
obj
|
||||||
|
|
||||||
template checkParamType*(obj: typed): auto =
|
template convertParamType*(obj: typed): auto =
|
||||||
obj
|
obj
|
||||||
|
|
||||||
macro asyncTask*(p: untyped): untyped =
|
macro asyncTask*(p: untyped): untyped =
|
||||||
@ -40,7 +40,7 @@ macro asyncTask*(p: untyped): untyped =
|
|||||||
var asyncBody = newStmtList()
|
var asyncBody = newStmtList()
|
||||||
let tcall = newCall(ident(name & "Tasklet"))
|
let tcall = newCall(ident(name & "Tasklet"))
|
||||||
for paramId, paramType in paramsIter(params):
|
for paramId, paramType in paramsIter(params):
|
||||||
tcall.add newCall("checkParamType", paramId)
|
tcall.add newCall("convertParamType", paramId)
|
||||||
asyncBody = quote:
|
asyncBody = quote:
|
||||||
let val {.inject.} = `tcall`
|
let val {.inject.} = `tcall`
|
||||||
discard jobResult.queue.send((jobResult.id, val))
|
discard jobResult.queue.send((jobResult.id, val))
|
||||||
@ -51,6 +51,7 @@ macro asyncTask*(p: untyped): untyped =
|
|||||||
ident"void"
|
ident"void"
|
||||||
else:
|
else:
|
||||||
params.getReturnType()
|
params.getReturnType()
|
||||||
|
|
||||||
let jobArg = nnkIdentDefs.newTree(
|
let jobArg = nnkIdentDefs.newTree(
|
||||||
ident"jobResult", nnkBracketExpr.newTree(ident"JobResult", retType), newEmptyNode()
|
ident"jobResult", nnkBracketExpr.newTree(ident"JobResult", retType), newEmptyNode()
|
||||||
)
|
)
|
||||||
@ -69,5 +70,5 @@ when isMainModule:
|
|||||||
type HashOptions* = object
|
type HashOptions* = object
|
||||||
striped*: bool
|
striped*: bool
|
||||||
|
|
||||||
proc doHashes2*(data: openArray[byte], opts: HashOptions): float {.asyncTask.} =
|
proc doHashes*(data: openArray[byte], opts: HashOptions): float {.asyncTask.} =
|
||||||
echo "hashing"
|
echo "hashing"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user