Use runActor proc
This commit is contained in:
parent
9ec580ff79
commit
fe76b714a5
|
@ -1,2 +1,4 @@
|
||||||
include_rules
|
include_rules
|
||||||
: foreach *.nim | $(SYNDICATE_PROTOCOL) ./<schema> |> !nim_bin |>
|
: foreach *.nim | $(SYNDICATE_PROTOCOL) ./<schema> |> !nim_bin |> {bin}
|
||||||
|
: foreach {bin} |> !assert_built |>
|
||||||
|
: $(BIN_DIR)/msg |> cp %f %o |> $(BIN_DIR)/beep
|
||||||
|
|
|
@ -30,7 +30,7 @@ proc hitch(a, b: Future[void]) =
|
||||||
if f.failed: fail(b, f.error)
|
if f.failed: fail(b, f.error)
|
||||||
else: complete(b)
|
else: complete(b)
|
||||||
|
|
||||||
bootDataspace("main") do (ds: Ref; turn: var Turn):
|
runActor("main") do (ds: Ref; turn: var Turn):
|
||||||
connectStdio(ds, turn)
|
connectStdio(ds, turn)
|
||||||
var
|
var
|
||||||
handlers: Table[seq[string], (Ref, set[HttpMethod])]
|
handlers: Table[seq[string], (Ref, set[HttpMethod])]
|
||||||
|
@ -88,5 +88,3 @@ bootDataspace("main") do (ds: Ref; turn: var Turn):
|
||||||
asyncCheck serve(http, port, handleRequest)
|
asyncCheck serve(http, port, handleRequest)
|
||||||
do:
|
do:
|
||||||
close(http)
|
close(http)
|
||||||
|
|
||||||
runForever()
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
|
# SPDX-FileCopyrightText: ☭ Emery Hemingway
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
import std/[asyncdispatch, asyncnet, json]
|
import std/[asyncdispatch, asyncnet, json]
|
||||||
|
@ -7,7 +7,7 @@ import preserves, preserves/jsonhooks, syndicate, syndicate/patterns
|
||||||
|
|
||||||
import ./schema/config
|
import ./schema/config
|
||||||
|
|
||||||
bootDataspace("main") do (root: Ref; turn: var Turn):
|
runActor("main") do (root: Ref; turn: var Turn):
|
||||||
connectStdio(root, turn)
|
connectStdio(root, turn)
|
||||||
during(turn, root, ?JsonSocketTranslatorArguments) do (ds: Ref, socketPath: string):
|
during(turn, root, ?JsonSocketTranslatorArguments) do (ds: Ref, socketPath: string):
|
||||||
let socket = newAsyncSocket(
|
let socket = newAsyncSocket(
|
||||||
|
@ -32,5 +32,3 @@ bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||||
asyncCheck(turn, send(socket, $js & "\n"))
|
asyncCheck(turn, send(socket, $js & "\n"))
|
||||||
else:
|
else:
|
||||||
writeLine(stderr, "cannot convert assertion to JSON - ", data)
|
writeLine(stderr, "cannot convert assertion to JSON - ", data)
|
||||||
|
|
||||||
runForever()
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
|
# SPDX-FileCopyrightText: ☭ Emery Hemingway
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
import std/[asyncdispatch, json, os, osproc, strutils]
|
import std/[asyncdispatch, json, os, osproc, strutils]
|
||||||
|
@ -33,9 +33,8 @@ proc translate(output: string): Assertion =
|
||||||
quit 1
|
quit 1
|
||||||
js.toPreserveHook(Ref)
|
js.toPreserveHook(Ref)
|
||||||
|
|
||||||
bootDataspace("main") do (root: Ref; turn: var Turn):
|
runActor("main") do (root: Ref; turn: var Turn):
|
||||||
connectStdio(root, turn)
|
connectStdio(root, turn)
|
||||||
onPublish(turn, root, ?JsonTranslatorArguments) do (ds: Ref):
|
during(turn, root, ?JsonTranslatorArguments) do (ds: Ref):
|
||||||
message(turn, ds, initRecord[Ref]("recv-json", runChild().translate()))
|
message(turn, ds, initRecord[Ref]("recv-json", runChild().translate()))
|
||||||
|
|
||||||
runForever()
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20230505"
|
version = "20230506"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "Utilites for Syndicated Actors and Synit"
|
description = "Utilites for Syndicated Actors and Synit"
|
||||||
license = "unlicense"
|
license = "unlicense"
|
||||||
|
|
Loading…
Reference in New Issue