Compare commits
9 Commits
8f4d69401a
...
26df57e049
Author | SHA1 | Date |
---|---|---|
Emery Hemingway | 26df57e049 | |
Emery Hemingway | 53faac3d20 | |
Emery Hemingway | 4d4f52c578 | |
Emery Hemingway | ae09e4b049 | |
Emery Hemingway | cec000e46f | |
Emery Hemingway | 1b990227af | |
Emery Hemingway | f50f65f257 | |
Emery Hemingway | 2097e5b9c6 | |
Emery Hemingway | a18d9673df |
29
README.md
29
README.md
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
26
src/msg.nim
26
src/msg.nim
|
@ -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)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Package
|
||||
|
||||
version = "20240405"
|
||||
version = "20240407"
|
||||
author = "Emery Hemingway"
|
||||
description = "Utilites for Syndicated Actors and Synit"
|
||||
license = "unlicense"
|
||||
|
|
Loading…
Reference in New Issue