Compare commits

..

9 Commits

4 changed files with 20 additions and 40 deletions

View File

@ -28,6 +28,7 @@ Example configuration:
$cap <cache { dataspace: $nixspace lifetime: 3600.0 }> ]
]
```
### File System Usage
Summarize the size of file-system directory. Equivalent to `du -s -b`.
@ -244,32 +245,8 @@ Sample Syndicate server script:
## msg
A utility that sends messages to `$SYNDICATE_ROUTE`.
## net_mapper
Publishes ICMP packet round-trip-times. See [net_mapper.prs](./net_mapper.prs) for a protocol description. [Source](./src/net_mapper.nim).
Example script:
```
? <machine-dataspace ?machine> [
$machine ? <rtt "10.0.33.136" ?min ?avg ?max> [
$log ! <log "-" { ping: { min: $min avg: $avg max: $max } }>
]
$config [
<require-service <daemon net_mapper>>
<daemon net_mapper {
argv: ["/bin/net_mapper"]
protocol: application/syndicate
}>
? <service-object <daemon net_mapper> ?cap> [
$cap { dataspace: $machine }
]
]
]
```
A utility that parses its command-line arguments as Preserves and send them as messages to `$SYNDICATE_ROUTE`.
When called as `assert` (by a symlink or a rename) it will make assertions instead.
## PostgreSQL

View File

@ -1,4 +1,5 @@
include_rules
: foreach *.nim | $(SYNDICATE_PROTOCOL) ./<schema> |> !nim_bin |> {bin}
: foreach {bin} |> !assert_built |>
: $(BIN_DIR)/msg |> cp %f %o |> $(BIN_DIR)/beep
: $(BIN_DIR)/msg |> !symlink |> $(BIN_DIR)/beep
: $(BIN_DIR)/msg |> !symlink |> $(BIN_DIR)/assert

View File

@ -1,20 +1,22 @@
# SPDX-FileCopyrightText: ☭ Emery Hemingway
# SPDX-License-Identifier: Unlicense
import std/[asyncdispatch, sequtils, os]
import std/[sequtils, os, strutils]
import preserves, syndicate, syndicate/relays
proc main =
let
route = envRoute()
data = map(commandLineParams(), parsePreserves)
setControlCHook(proc () {.noconv.} = quit())
discard bootDataspace("msg") do (turn: var Turn; root: Cap):
spawnRelays(turn, root)
resolve(turn, root, route) do (turn: var Turn; ds: Cap):
runActor("msg") do (turn: var Turn):
let
data = map(commandLineParams(), parsePreserves)
cmd = paramStr(0).extractFilename.normalize
resolveEnvironment(turn) do (turn: var Turn; ds: Cap):
case cmd
of "assert":
for e in data:
publish(turn, ds, e)
else: # "msg"
for e in data:
message(turn, ds, e)
for _ in 1..2: poll()
main()
sync(turn, ds) do (turn: var Turn):
stopActor(turn)

View File

@ -1,6 +1,6 @@
# Package
version = "20240405"
version = "20240407"
author = "Emery Hemingway"
description = "Utilites for Syndicated Actors and Synit"
license = "unlicense"