Idomatic dataspace passing at boot
This commit is contained in:
parent
2a421a0e53
commit
5a9e940a7d
21
README.md
21
README.md
|
@ -10,22 +10,21 @@ For a list of possibly supported properties see the [Fontconfig documentation](h
|
|||
|
||||
Example [Syndicate server](https://git.syndicate-lang.org/syndicate-lang/syndicate-rs) configuration:
|
||||
```
|
||||
<require-service <daemon fontconfig_actor>>
|
||||
let ?fontspace = dataspace
|
||||
<fontspace $fontspace>
|
||||
|
||||
<daemon fontconfig_actor {
|
||||
argv: [ "/usr/local/bin/fontconfig_actor" ]
|
||||
protocol: application/syndicate
|
||||
}>
|
||||
|
||||
let ?fontspace = dataspace
|
||||
<fontspace $fontspace>
|
||||
|
||||
? <service-object <daemon fontconfig_actor> ?cap> [
|
||||
$cap <serve $fontspace>
|
||||
]
|
||||
|
||||
$fontspace [
|
||||
? <fontconfig {size: 8.0, spacing: proportional} ?properties> [
|
||||
$log ! <log "-" { line: <fontconfig $properties> }>
|
||||
? <fontspace ?fontspace> [
|
||||
<require-service <daemon fontconfig_actor>>
|
||||
? <service-object <daemon fontconfig_actor> ?cap> [
|
||||
$cap { dataspace: $fontspace }
|
||||
$socketspace ? <fontconfig {size: 8.0, spacing: proportional} ?properties> [
|
||||
$log ! <log "-" { line: <fontconfig $properties> }>
|
||||
]
|
||||
]
|
||||
]
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Package
|
||||
|
||||
version = "20230329"
|
||||
version = "20230502"
|
||||
author = "Emery Hemingway"
|
||||
description = "Syndicate actor for asserting Fontconfig information"
|
||||
license = "Unlicense"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version 1 .
|
||||
Serve = <serve @cap #!any> .
|
||||
BootArguments = {dataspace: #!any} .
|
||||
Properties = {symbol: any ...:...} .
|
||||
FontAssertion = <fontconfig @pattern Properties @attributes Properties> .
|
||||
|
|
|
@ -168,7 +168,7 @@ proc serve(ds: Ref; turn: var Turn) =
|
|||
|
||||
bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||
connectStdio(root, turn)
|
||||
during(turn, root, ?Serve) do (ds: Ref):
|
||||
onPublish(turn, root, ?BootArguments) do (ds: Ref):
|
||||
serve(ds, turn)
|
||||
|
||||
runForever()
|
||||
|
|
|
@ -3,16 +3,16 @@ import
|
|||
std/typetraits, preserves, std/tables
|
||||
|
||||
type
|
||||
Serve* {.preservesRecord: "serve".} = object
|
||||
`cap`* {.preservesEmbedded.}: Preserve[void]
|
||||
|
||||
FontAssertion* {.preservesRecord: "fontconfig".} = object
|
||||
`pattern`*: Properties
|
||||
`attributes`*: Properties
|
||||
|
||||
BootArguments* {.preservesDictionary.} = object
|
||||
`dataspace`* {.preservesEmbedded.}: Preserve[void]
|
||||
|
||||
Properties* = Table[Symbol, Preserve[void]]
|
||||
proc `$`*(x: Serve | FontAssertion | Properties): string =
|
||||
proc `$`*(x: FontAssertion | BootArguments | Properties): string =
|
||||
`$`(toPreserve(x))
|
||||
|
||||
proc encode*(x: Serve | FontAssertion | Properties): seq[byte] =
|
||||
proc encode*(x: FontAssertion | BootArguments | Properties): seq[byte] =
|
||||
encode(toPreserve(x))
|
||||
|
|
Loading…
Reference in New Issue