Update to build in meta-repo
This commit is contained in:
parent
7c9765fd23
commit
4b3c8cfa98
|
@ -0,0 +1,5 @@
|
|||
include_rules
|
||||
modules += json_socket_translator.nim
|
||||
modules += json_translator.nim
|
||||
modules += msg.nim
|
||||
: foreach $(modules) | $(SYNDICATE_PROTOCOL) ./<schema> |> !nim_bin |>
|
|
@ -37,7 +37,7 @@ bootDataspace("main") do (ds: Ref; turn: var Turn):
|
|||
pathPrefixMaxLen = 0
|
||||
requestIdSource = 0
|
||||
|
||||
during(turn, ds, ?Handler[Ref]) do (methods: Methods; path: seq[string]; entity: Ref):
|
||||
during(turn, ds, ?Handler) do (methods: Methods; path: seq[string]; entity: Ref):
|
||||
handlers[path] = (entity, methods.toHttpCore)
|
||||
pathPrefixMaxLen = max(pathPrefixMaxLen, path.len)
|
||||
do:
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
import std/[asyncdispatch, os]
|
||||
from std/sequtils import map
|
||||
import preserves, syndicate, syndicate/capabilities
|
||||
|
||||
proc unixSocketPath: string =
|
||||
|
@ -12,7 +11,7 @@ proc unixSocketPath: string =
|
|||
|
||||
proc mintCap: SturdyRef =
|
||||
var key: array[16, byte]
|
||||
mint(key, "syndicate")
|
||||
mint(key, toPreserve("syndicate", Ref))
|
||||
|
||||
bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||
let label = getAppFilename().extractFilename
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
include_rules
|
||||
: foreach ../../*.prs |> !preserves_schema_nim |> %B.nim
|
||||
: foreach ../../*.prs |> !preserves_schema_nim |> %B.nim | ../<schema>
|
||||
|
|
|
@ -1,44 +1,38 @@
|
|||
|
||||
import
|
||||
std/typetraits, preserves, std/tables, std/sets
|
||||
std/typetraits, preserves, std/tables
|
||||
|
||||
type
|
||||
Path* = seq[string]
|
||||
Headers* = TableRef[string, seq[string]]
|
||||
Headers* = Table[string, seq[string]]
|
||||
Response* {.preservesRecord: "http".} = object
|
||||
`handle`*: int
|
||||
`code`*: int
|
||||
`handle`*: BiggestInt
|
||||
`code`*: BiggestInt
|
||||
`headers`*: Headers
|
||||
`body`*: string
|
||||
|
||||
Listener* {.preservesRecord: "listen".} = object
|
||||
`port`*: int
|
||||
`port`*: BiggestInt
|
||||
|
||||
Handler*[E] {.preservesRecord: "handler".} = ref object
|
||||
Handler* {.preservesRecord: "handler".} = object
|
||||
`methods`*: Methods
|
||||
`path`*: Path
|
||||
`entity`*: Preserve[E]
|
||||
`entity`* {.preservesEmbedded.}: Preserve[void]
|
||||
|
||||
`Method`* {.preservesOr, pure.} = enum
|
||||
`GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `CONNECT`, `OPTIONS`, `TRACE`,
|
||||
`PATCH`
|
||||
Request* {.preservesRecord: "http".} = object
|
||||
`handle`*: int
|
||||
`handle`*: BiggestInt
|
||||
`method`*: Method
|
||||
`headers`*: Headers
|
||||
`path`*: Path
|
||||
`body`*: string
|
||||
|
||||
Methods* = HashSet[Method]
|
||||
proc `$`*[E](x: Handler[E]): string =
|
||||
`$`(toPreserve(x, E))
|
||||
|
||||
proc encode*[E](x: Handler[E]): seq[byte] =
|
||||
encode(toPreserve(x, E))
|
||||
|
||||
proc `$`*(x: Path | Headers | Response | Listener | Request | Methods): string =
|
||||
Methods* = set[Method]
|
||||
proc `$`*(x: Path | Headers | Response | Listener | Handler | Request | Methods): string =
|
||||
`$`(toPreserve(x))
|
||||
|
||||
proc encode*(x: Path | Headers | Response | Listener | Request | Methods): seq[
|
||||
byte] =
|
||||
proc encode*(x: Path | Headers | Response | Listener | Handler | Request |
|
||||
Methods): seq[byte] =
|
||||
encode(toPreserve(x))
|
||||
|
|
|
@ -3,16 +3,16 @@ import
|
|||
std/typetraits, preserves
|
||||
|
||||
type
|
||||
Notify*[E] {.preservesRecord: "notify".} = ref object
|
||||
Notify* {.preservesRecord: "notify".} = object
|
||||
`summary`*: string
|
||||
`body`*: Preserve[E]
|
||||
`timeout`*: int
|
||||
`body`*: Preserve[void]
|
||||
`timeout`*: BiggestInt
|
||||
`urgency`*: Urgency
|
||||
|
||||
`Urgency`* {.preservesOr, pure.} = enum
|
||||
`Low`, `Normal`, `Critical`
|
||||
proc `$`*[E](x: Notify[E]): string =
|
||||
`$`(toPreserve(x, E))
|
||||
proc `$`*(x: Notify): string =
|
||||
`$`(toPreserve(x))
|
||||
|
||||
proc encode*[E](x: Notify[E]): seq[byte] =
|
||||
encode(toPreserve(x, E))
|
||||
proc encode*(x: Notify): seq[byte] =
|
||||
encode(toPreserve(x))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Package
|
||||
|
||||
version = "99999999"
|
||||
version = "20230301"
|
||||
author = "Emery Hemingway"
|
||||
description = "Utilites for Syndicated Actors and Synit"
|
||||
license = "unlicense"
|
||||
|
|
Loading…
Reference in New Issue