diff --git a/README.md b/README.md index d2f0bbe..9d87be0 100644 --- a/README.md +++ b/README.md @@ -123,38 +123,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 -> - -let ?sqlspace = dataspace - -? ?cap> [ - $cap -] - -let ?tuplespace = dataspace - -$sqlspace - -$tuplespace ? [?id ?name] [ - $log ! }> -] -``` - ### Pulse proxy A proxy actor that passes assertions and messages to a configured capability but only asserts observations on a a periodic pulse. @@ -225,28 +193,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 [ - ? [ - ? [ - $log ! - ] - ] -] - -> -? ?cap> $cap [ - - -] -``` - --- ## mintsturdyref @@ -325,7 +271,89 @@ Example script: ] ``` +## 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 +> + +let ?sqlspace = dataspace + +? ?cap> [ + $cap +] + +let ?tuplespace = dataspace + +$sqlspace + +$tuplespace ? [?id ?name] [ + $log ! }> +] +``` + ## preserve_process_environment 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. + +## 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 +> + +let ?sqlspace = dataspace + +? ?cap> [ + $cap +] + +let ?tuplespace = dataspace + +$sqlspace + +$tuplespace ? [?id ?name] [ + $log ! }> +] +``` + +## 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 [ + ? [ + ? [ + $log ! + ] + ] +] + +> +? ?cap> $cap [ + + +] +``` diff --git a/src/syndesizer/postgre_actor.nim b/src/postgre_actor.nim similarity index 99% rename from src/syndesizer/postgre_actor.nim rename to src/postgre_actor.nim index 10010b9..e320bfe 100644 --- a/src/syndesizer/postgre_actor.nim +++ b/src/postgre_actor.nim @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Unlicense import preserves, syndicate -import ../schema/[config, sql] +import ./schema/[config, sql] {.passL: "-lpq".} @@ -126,6 +126,7 @@ proc spawnPostgreActor*(turn: var Turn; root: Cap): Actor {.discardable.} = when isMainModule: import syndicate/relays + runActor("main") do (turn: var Turn): resolveEnvironment(turn) do (turn: var Turn; ds: Cap): spawnPostgreActor(turn, ds) diff --git a/src/syndesizer/sqlite_actor.nim b/src/sqlite_actor.nim similarity index 99% rename from src/syndesizer/sqlite_actor.nim rename to src/sqlite_actor.nim index 785c01f..26205d5 100644 --- a/src/syndesizer/sqlite_actor.nim +++ b/src/sqlite_actor.nim @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Unlicense import preserves, syndicate -import ../schema/[config, sql] +import ./schema/[config, sql] # Avoid Sqlite3 from the standard library because it is # only held together by wishful thinking and dlload. diff --git a/src/syndesizer.nim b/src/syndesizer.nim index 68470ef..3e9a740 100644 --- a/src/syndesizer.nim +++ b/src/syndesizer.nim @@ -5,10 +5,6 @@ import syndicate, syndicate/relays, syndicate/drivers/timers -const - withPostgre* {.booldefine.}: bool = true - withSqlite* {.booldefine.}: bool = true - import ./syndesizer/[ base64_decoder, cache_actor, @@ -16,14 +12,7 @@ import ./syndesizer/[ json_socket_translator, json_translator, pulses, - xml_translator, - xslt_actor] - -when withPostgre: - import ./syndesizer/postgre_actor - -when withSqlite: - import ./syndesizer/sqlite_actor + xml_translator] runActor("syndesizer") do (turn: var Turn): resolveEnvironment(turn) do (turn: var Turn; ds: Cap): @@ -35,8 +24,3 @@ runActor("syndesizer") do (turn: var Turn): discard spawnJsonStdioTranslator(turn, ds) discard spawnPulseActor(turn, ds) discard spawnXmlTranslator(turn, ds) - discard spawnXsltActor(turn, ds) - when withPostgre: - discard spawnPostgreActor(turn, ds) - when withSqlite: - discard spawnSqliteActor(turn, ds) diff --git a/src/syndesizer/xslt_actor.nim b/src/xslt_actor.nim similarity index 99% rename from src/syndesizer/xslt_actor.nim rename to src/xslt_actor.nim index 3b7a12d..8b81879 100644 --- a/src/syndesizer/xslt_actor.nim +++ b/src/xslt_actor.nim @@ -3,7 +3,7 @@ import std/[os, strutils] import preserves, syndicate -import ../schema/[assertions, config] +import ./schema/[assertions, config] {.passC: staticExec("pkg-config --cflags libxslt").} {.passL: staticExec("pkg-config --libs libxslt").}