Use runActor proc

This commit is contained in:
Emery Hemingway 2023-05-06 20:08:38 +01:00
parent 9ec580ff79
commit fe76b714a5
5 changed files with 10 additions and 13 deletions

View File

@ -1,2 +1,4 @@
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

View File

@ -30,7 +30,7 @@ proc hitch(a, b: Future[void]) =
if f.failed: fail(b, f.error)
else: complete(b)
bootDataspace("main") do (ds: Ref; turn: var Turn):
runActor("main") do (ds: Ref; turn: var Turn):
connectStdio(ds, turn)
var
handlers: Table[seq[string], (Ref, set[HttpMethod])]
@ -88,5 +88,3 @@ bootDataspace("main") do (ds: Ref; turn: var Turn):
asyncCheck serve(http, port, handleRequest)
do:
close(http)
runForever()

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
# SPDX-FileCopyrightText: ☭ Emery Hemingway
# SPDX-License-Identifier: Unlicense
import std/[asyncdispatch, asyncnet, json]
@ -7,7 +7,7 @@ import preserves, preserves/jsonhooks, syndicate, syndicate/patterns
import ./schema/config
bootDataspace("main") do (root: Ref; turn: var Turn):
runActor("main") do (root: Ref; turn: var Turn):
connectStdio(root, turn)
during(turn, root, ?JsonSocketTranslatorArguments) do (ds: Ref, socketPath: string):
let socket = newAsyncSocket(
@ -32,5 +32,3 @@ bootDataspace("main") do (root: Ref; turn: var Turn):
asyncCheck(turn, send(socket, $js & "\n"))
else:
writeLine(stderr, "cannot convert assertion to JSON - ", data)
runForever()

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
# SPDX-FileCopyrightText: ☭ Emery Hemingway
# SPDX-License-Identifier: Unlicense
import std/[asyncdispatch, json, os, osproc, strutils]
@ -33,9 +33,8 @@ proc translate(output: string): Assertion =
quit 1
js.toPreserveHook(Ref)
bootDataspace("main") do (root: Ref; turn: var Turn):
runActor("main") do (root: Ref; turn: var 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()))
runForever()

View File

@ -1,6 +1,6 @@
# Package
version = "20230505"
version = "20230506"
author = "Emery Hemingway"
description = "Utilites for Syndicated Actors and Synit"
license = "unlicense"