Syndicate API update
This commit is contained in:
parent
4b3c8cfa98
commit
1ce129fd56
|
@ -1,3 +1,4 @@
|
|||
/.direnv
|
||||
http_translator
|
||||
json_translator
|
||||
msg
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
include ../syndicate-nim/depends.tup
|
||||
NIM_FLAGS += --path:$(TUP_CWD)/../syndicate-nim/src
|
|
@ -1,5 +1,2 @@
|
|||
include_rules
|
||||
modules += json_socket_translator.nim
|
||||
modules += json_translator.nim
|
||||
modules += msg.nim
|
||||
: foreach $(modules) | $(SYNDICATE_PROTOCOL) ./<schema> |> !nim_bin |>
|
||||
: foreach *.nim | $(SYNDICATE_PROTOCOL) ./<schema> |> !nim_bin |>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
|
||||
# SPDX-FileCopyrightText: ☭ Emery Hemingway
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
import std/[asyncdispatch, asynchttpserver, sets, strutils, tables, uri]
|
||||
import std/[asyncdispatch, asynchttpserver, strutils, tables, uri]
|
||||
import preserves
|
||||
import syndicate, syndicate/actors
|
||||
|
||||
|
@ -74,7 +74,7 @@ bootDataspace("main") do (ds: Ref; turn: var Turn):
|
|||
let rHandle = publish(turn, entity, http_protocol.Request(
|
||||
handle: rId,
|
||||
`method`: Method.GET,
|
||||
headers: req.headers.table,
|
||||
headers: req.headers.table[],
|
||||
path: path,
|
||||
body: req.body))
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ bootDataspace("main") do (ds: Ref; turn: var Turn):
|
|||
buffered = false)
|
||||
waitFor connectUnix(socket, socketPath)
|
||||
|
||||
onMessage(turn, ds, recordPattern(label, ?1, grab())) do (data: Assertion):
|
||||
onMessage(turn, ds, recordPattern(label, ?toPreserve(1), grab())) do (data: Assertion):
|
||||
var js: JsonNode
|
||||
if fromPreserve(js, data):
|
||||
asyncCheck socket.send($js & "\n")
|
||||
|
|
|
@ -9,13 +9,9 @@ proc unixSocketPath: string =
|
|||
if result == "":
|
||||
result = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace"
|
||||
|
||||
proc mintCap: SturdyRef =
|
||||
var key: array[16, byte]
|
||||
mint(key, toPreserve("syndicate", Ref))
|
||||
|
||||
bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||
let label = getAppFilename().extractFilename
|
||||
connectUnix(turn, unixSocketPath(), mintCap()) do (turn: var Turn; ds: Ref):
|
||||
connectUnix(turn, unixSocketPath(), capabilities.mint()) do (turn: var Turn; ds: Ref):
|
||||
var a = initRecord[Ref](label, commandLineParams().toPreserve(Ref))
|
||||
message(turn, ds, a)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Package
|
||||
|
||||
version = "20230301"
|
||||
version = "20230410"
|
||||
author = "Emery Hemingway"
|
||||
description = "Utilites for Syndicated Actors and Synit"
|
||||
license = "unlicense"
|
||||
|
|
Loading…
Reference in New Issue