Move actors with shared libraries out of syndesizer
This commit is contained in:
parent
cec000e46f
commit
ae09e4b049
136
README.md
136
README.md
|
@ -124,38 +124,6 @@ let ?ds = dataspace
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
### PostgreSQL
|
|
||||||
|
|
||||||
Readonly access to PostgreSQL databases. Asserts rows as records in response to SQL query assertions. Dynamic updates are not implemented.
|
|
||||||
|
|
||||||
Can be disabled by passing `--define:withPostgre=no` to the Nim compiler.
|
|
||||||
|
|
||||||
```
|
|
||||||
# Configuration example
|
|
||||||
<require-service <daemon syndesizer>>
|
|
||||||
|
|
||||||
let ?sqlspace = dataspace
|
|
||||||
|
|
||||||
? <service-object <daemon syndesizer> ?cap> [
|
|
||||||
$cap <postgre {
|
|
||||||
dataspace: $sqlspace
|
|
||||||
connection: [
|
|
||||||
["host" "example.com"]
|
|
||||||
["dbname" "foobar"]
|
|
||||||
["user" "hackme"]
|
|
||||||
]
|
|
||||||
}>
|
|
||||||
]
|
|
||||||
|
|
||||||
let ?tuplespace = dataspace
|
|
||||||
|
|
||||||
$sqlspace <query "SELECT id, name FROM stuff" $tuplespace>
|
|
||||||
|
|
||||||
$tuplespace ? [?id ?name] [
|
|
||||||
$log ! <log "-" { row: <example-row $id $name> }>
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pulse proxy
|
### Pulse proxy
|
||||||
|
|
||||||
A proxy actor that passes assertions and messages to a configured capability but only asserts observations on a a periodic pulse.
|
A proxy actor that passes assertions and messages to a configured capability but only asserts observations on a a periodic pulse.
|
||||||
|
@ -226,28 +194,6 @@ Examples:
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
### XSLT processor
|
|
||||||
|
|
||||||
Perform XML stylesheet transformations. For a given textual XSLT stylesheet and a textual XML document generate an abstract XML document in Preserves form. Inputs may be XML text or paths to XML files.
|
|
||||||
|
|
||||||
```
|
|
||||||
# Configuration example
|
|
||||||
let ?ds = dataspace
|
|
||||||
$ds [
|
|
||||||
? <xslt-transform "/stylesheet.xls" "/doc.xml" ?output> [
|
|
||||||
? <xml-translation ?text $output> [
|
|
||||||
$log ! <log "-" { xslt-output: $text }>
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
<require-service <daemon syndesizer>>
|
|
||||||
? <service-object <daemon syndesizer> ?cap> $cap [
|
|
||||||
<xml-translator { dataspace: $ds }>
|
|
||||||
<xslt { dataspace: $ds }>
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## mintsturdyref
|
## mintsturdyref
|
||||||
|
@ -301,7 +247,89 @@ Sample Syndicate server script:
|
||||||
|
|
||||||
A utility that sends messages to `$SYNDICATE_ROUTE`.
|
A utility that sends messages to `$SYNDICATE_ROUTE`.
|
||||||
|
|
||||||
|
## PostgreSQL
|
||||||
|
|
||||||
|
Readonly access to PostgreSQL databases. Asserts rows as records in response to SQL query assertions. Dynamic updates are not implemented.
|
||||||
|
|
||||||
|
Can be disabled by passing `--define:withPostgre=no` to the Nim compiler.
|
||||||
|
|
||||||
|
```
|
||||||
|
# Configuration example
|
||||||
|
<require-service <daemon postgre_actor>>
|
||||||
|
|
||||||
|
let ?sqlspace = dataspace
|
||||||
|
|
||||||
|
? <service-object <daemon postgre_actor> ?cap> [
|
||||||
|
$cap <postgre {
|
||||||
|
dataspace: $sqlspace
|
||||||
|
connection: [
|
||||||
|
["host" "example.com"]
|
||||||
|
["dbname" "foobar"]
|
||||||
|
["user" "hackme"]
|
||||||
|
]
|
||||||
|
}>
|
||||||
|
]
|
||||||
|
|
||||||
|
let ?tuplespace = dataspace
|
||||||
|
|
||||||
|
$sqlspace <query "SELECT id, name FROM stuff" $tuplespace>
|
||||||
|
|
||||||
|
$tuplespace ? [?id ?name] [
|
||||||
|
$log ! <log "-" { row: <example-row $id $name> }>
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
## preserve_process_environment
|
## preserve_process_environment
|
||||||
|
|
||||||
This utility serializes it's process environment to Preserves and prints it to stdout.
|
This utility serializes it's process environment to Preserves and prints it to stdout.
|
||||||
It can be used to feed the environment variables of a nested child of the Syndicate server back to the server. For example, to retreive the environmental variables that a desktop manager passed on to its children.
|
It can be used to feed the environment variables of a nested child of the Syndicate server back to the server. For example, to retreive the environmental variables that a desktop manager passed on to its children.
|
||||||
|
|
||||||
|
## SQLite
|
||||||
|
|
||||||
|
Readonly access to SQLite databases. Asserts rows as records in response to SQL query assertions. Dynamic updates are not implemented.
|
||||||
|
|
||||||
|
Can be disabled by passing `--define:withSqlite=no` to the Nim compiler.
|
||||||
|
|
||||||
|
```
|
||||||
|
# Configuration example
|
||||||
|
<require-service <daemon sqlite_actor>>
|
||||||
|
|
||||||
|
let ?sqlspace = dataspace
|
||||||
|
|
||||||
|
? <service-object <daemon sqlite_actor> ?cap> [
|
||||||
|
$cap <sqlite {
|
||||||
|
dataspace: $sqlspace
|
||||||
|
database: "/var/db/example.db"
|
||||||
|
}>
|
||||||
|
]
|
||||||
|
|
||||||
|
let ?tuplespace = dataspace
|
||||||
|
|
||||||
|
$sqlspace <query "SELECT id, name FROM stuff" $tuplespace>
|
||||||
|
|
||||||
|
$tuplespace ? [?id ?name] [
|
||||||
|
$log ! <log "-" { row: <example-row $id $name> }>
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## XSLT processor
|
||||||
|
|
||||||
|
Perform XML stylesheet transformations. For a given textual XSLT stylesheet and a textual XML document generate an abstract XML document in Preserves form. Inputs may be XML text or paths to XML files.
|
||||||
|
|
||||||
|
```
|
||||||
|
# Configuration example
|
||||||
|
let ?ds = dataspace
|
||||||
|
$ds [
|
||||||
|
? <xslt-transform "/stylesheet.xls" "/doc.xml" ?output> [
|
||||||
|
? <xml-translation ?text $output> [
|
||||||
|
$log ! <log "-" { xslt-output: $text }>
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
<require-service <daemon xslt_actor>>
|
||||||
|
? <service-object <daemon xslt_actor> ?cap> $cap [
|
||||||
|
<xml-translator { dataspace: $ds }>
|
||||||
|
<xslt { dataspace: $ds }>
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
import preserves, syndicate
|
import preserves, syndicate
|
||||||
import ../schema/[config, sql]
|
import ./schema/[config, sql]
|
||||||
|
|
||||||
{.passL: "-lpq".}
|
{.passL: "-lpq".}
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ proc spawnPostgreActor*(turn: var Turn; root: Cap): Actor {.discardable.} =
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
import syndicate/relays
|
import syndicate/relays
|
||||||
|
|
||||||
runActor("main") do (turn: var Turn):
|
runActor("main") do (turn: var Turn):
|
||||||
resolveEnvironment(turn) do (turn: var Turn; ds: Cap):
|
resolveEnvironment(turn) do (turn: var Turn; ds: Cap):
|
||||||
spawnPostgreActor(turn, ds)
|
spawnPostgreActor(turn, ds)
|
|
@ -2,7 +2,7 @@
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
import preserves, syndicate
|
import preserves, syndicate
|
||||||
import ../schema/[config, sql]
|
import ./schema/[config, sql]
|
||||||
|
|
||||||
# Avoid Sqlite3 from the standard library because it is
|
# Avoid Sqlite3 from the standard library because it is
|
||||||
# only held together by wishful thinking and dlload.
|
# only held together by wishful thinking and dlload.
|
|
@ -5,10 +5,6 @@
|
||||||
|
|
||||||
import syndicate, syndicate/relays, syndicate/drivers/timers
|
import syndicate, syndicate/relays, syndicate/drivers/timers
|
||||||
|
|
||||||
const
|
|
||||||
withPostgre* {.booldefine.}: bool = true
|
|
||||||
withSqlite* {.booldefine.}: bool = true
|
|
||||||
|
|
||||||
import ./syndesizer/[
|
import ./syndesizer/[
|
||||||
base64_decoder,
|
base64_decoder,
|
||||||
cache_actor,
|
cache_actor,
|
||||||
|
@ -16,14 +12,7 @@ import ./syndesizer/[
|
||||||
json_socket_translator,
|
json_socket_translator,
|
||||||
json_translator,
|
json_translator,
|
||||||
pulses,
|
pulses,
|
||||||
xml_translator,
|
xml_translator]
|
||||||
xslt_actor]
|
|
||||||
|
|
||||||
when withPostgre:
|
|
||||||
import ./syndesizer/postgre_actor
|
|
||||||
|
|
||||||
when withSqlite:
|
|
||||||
import ./syndesizer/sqlite_actor
|
|
||||||
|
|
||||||
runActor("syndesizer") do (turn: var Turn):
|
runActor("syndesizer") do (turn: var Turn):
|
||||||
resolveEnvironment(turn) do (turn: var Turn; ds: Cap):
|
resolveEnvironment(turn) do (turn: var Turn; ds: Cap):
|
||||||
|
@ -35,8 +24,3 @@ runActor("syndesizer") do (turn: var Turn):
|
||||||
discard spawnJsonStdioTranslator(turn, ds)
|
discard spawnJsonStdioTranslator(turn, ds)
|
||||||
discard spawnPulseActor(turn, ds)
|
discard spawnPulseActor(turn, ds)
|
||||||
discard spawnXmlTranslator(turn, ds)
|
discard spawnXmlTranslator(turn, ds)
|
||||||
discard spawnXsltActor(turn, ds)
|
|
||||||
when withPostgre:
|
|
||||||
discard spawnPostgreActor(turn, ds)
|
|
||||||
when withSqlite:
|
|
||||||
discard spawnSqliteActor(turn, ds)
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import std/[os, strutils]
|
import std/[os, strutils]
|
||||||
import preserves, syndicate
|
import preserves, syndicate
|
||||||
import ../schema/[assertions, config]
|
import ./schema/[assertions, config]
|
||||||
|
|
||||||
{.passC: staticExec("pkg-config --cflags libxslt").}
|
{.passC: staticExec("pkg-config --cflags libxslt").}
|
||||||
{.passL: staticExec("pkg-config --libs libxslt").}
|
{.passL: staticExec("pkg-config --libs libxslt").}
|
|
@ -5,7 +5,7 @@ author = "Emery Hemingway"
|
||||||
description = "Utilites for Syndicated Actors and Synit"
|
description = "Utilites for Syndicated Actors and Synit"
|
||||||
license = "unlicense"
|
license = "unlicense"
|
||||||
srcDir = "src"
|
srcDir = "src"
|
||||||
bin = @["mintsturdyref", "mount_actor", "msg", "preserve_process_environment", "rofi_script_actor", "syndesizer"]
|
bin = @["mintsturdyref", "mount_actor", "msg", "postgre_actor", "preserve_process_environment", "rofi_script_actor", "sqlite_actor", "syndesizer", "xslt_actor"]
|
||||||
|
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
Loading…
Reference in New Issue