# Syndicate utils ## Syndesizer A Syndicate multitool that includes a number of different actors that become active via configuration. Think of it as a Busybox for Syndicate, if Busybox was created before POSIX. Whether you use a single instance for many protocols or many specialized instances is up to you. ### Cache Observes patterns and reässert the values captured for a given lifetime. Takes the argument ``. The lifetime of a cache counts down from moment a value is asserted. Example configuration: ``` ? [ ; Require the nix_actor during observations. ?nixspace> ? _> [ $config > ] ?nixspace> ? _> [ $config > ] ; Cache anything captured by observers in the $nixspace for an hour. ; The nix_actor is not required during caching. $config > $config ? ?cap> [ $cap ] ] ``` ### File System Usage Summarize the size of file-system directory. Equivalent to `du -s -b`. Query the size of a directory in bytes by observing ``. ``` # Configuration example ? [ > ? ?cap> [ $cap ] ] ``` ### JSON Socket Translator Communicate with sockets that send and receive lines of JSON using `` and `` messages. Do not send messages into the dataspace configure with `` until `` is asserted. ``` # MPV configuration example > let ?mpvSpace = dataspace ? ready> [ > ? ?cap> [ $cap }> ] ] $mpvSpace [ # announce the dataspace when the translator is connected ? [ $config $config $mpvSpace #f> ] # translate to an MPV command ?? [ ! ] # clear the playlist on idle so it doesn't grow indefinitely ?? [ ! ] ] ``` ### JSON Stdio Translator Executes a command, parses its JSON output, converts to record ``, and publishes and messages it to a dataspace. ``` # Configuration example > let ?ds = dataspace $ds #f> ? ?cap> [ $cap ] ``` ### Pulse proxy A proxy actor that passes assertions and messages to a configured capability but only asserts observations on a a periodic pulse. This can be used to implement polling behavior. ``` # Example config let ?ds = dataspace > ? ?cap> [ $cap ] $ds ? [ $proxy ? [ $log ! ] ] ``` ### 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 ! }> ] ``` ### XML translator Translates between Preserves and XML according to the [Conventions for Common Data Types](https://preserves.dev/conventions.html). Examples: - ` hello world!" >>` - `` - `>" #f>` ``` # Configuration example ? [ $ds ? _> $config [ $config > $config ? ?cap> [ $cap ] ] ] ``` --- ## mintsturdyref A utility for minting [Sturdyrefs](https://synit.org/book/operation/builtin/gatekeeper.html#sturdyrefs). ## mount_actor Actor for mounting filesystems on Linux. Sample Syndicate server script: ``` # Assert a file-system we want to mount. # Transform mount assertions into mount status observations. ? [ ? [ ] ] # Assert mounting succeded. ? [ ready> ] # Assert mount failed. ? > [ failed> ] # Assert the details into the machine dataspace. ? [ $config ? [ $machine ] ] # Require the mount_actor daemon. > # Pass the daemon the config dataspace. ? ?cap> [ $cap { dataspace: $config } ] ``` ## msg 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 > 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 ! }> ] ``` ## syndump Utility for printing assertions and messages. Parses the command-line arguments as a pattern, connects a dataspace via `$SYNDICATE_ROUTE`, and writes observations to standard-output. Published assertions are prefixed by the `+` character, retractions by `-`, and messages by `!`. Example ```sh # Print patterns in use, filter down with AWK to only the published patterns. $ FS=':' syndump '' | awk -F : '/^+/ { print $2 }' ``` ## 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 [ ] ```