skip to content
[readonly]

meshd's control port: one request line, one reply (a line or a framed body), every request byte for byte as the Rust

sh
$ sexc add @ajax/mesh-control
  • total 3
  • drwxr-xr-x-../
  • drwxr-xr-x-Oct 27 05:23v/# 1 version
  • drwxr-xr-x-Oct 27 05:23files/# the files of 0.1.0
latest
0.1.0, published Oct 27 05:23 by ajax
owners
ajax
license
MIT
dependencies
@ajax/mesh-shared ^0.1.0, @ajax/mesh-snapshot ^0.1.0, @ajax/mesh-prog-table ^0.1.0, @ajax/mesh-loader ^0.1.0, @ajax/mesh-load-text ^0.1.0, @ajax/mesh-inferd ^0.1.0, @ajax/mesh-infer-request ^0.1.0, @ajax/mesh-views ^0.1.0, @ajax/mesh-backend ^0.1.0, @ajax/mesh-log ^0.1.0, @ajax/mesh-abi ^0.1.0, @ajax/mesh-buf ^0.1.0, @ajax/mesh-rsfmt ^0.1.0, @ajax/mesh-chan ^0.1.0, @ajax/mesh-reply ^0.1.0, @ajax/mesh-check ^0.1.0
dependents
@ajax/mesh-http-relay, @ajax/meshd
keywords
mesh alphaos control protocol tcp daemon
homepage
https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-control
repository
https://github.com/thomasdavis/alpha-c-mesh
==> README.md <==
1# @ajax/mesh-control
2
3meshd's control port: one request line, one reply (a line or a framed body), every request byte for byte as the Rust.
4
5The control port (control.rs; mesh-abi "control protocol").
6
7One text line per request, a text line back (`ok ...` / `err ...`), except the framed replies (u32 LE length + bytes): `snap`, `programs`, `catalog`, `req`, `peek`, `log`, `trace`, `http`, `cluster`, `load`, `fleet`, `groups`, `sched`, `sched explain <name>`, `sched dry-run`, `jobs`, `job status`, `job results`. In a fleet every lifecycle change (load, upgrade, rollback, unload, start, stop, reset, place, the lockstep program's tasks, `group ...`) is a change of the desired state: it goes to the leader, which commits it and answers once the reachable members reconciled it.
8
9A request line is at most 4096 bytes, at most 32 clients are served at once, a client idle for 120 s (or not taking a reply within 10 s) is closed.
10
11```c
12#include "mesh/control.h"
13```
14
15## Ported from
16
17[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT): crates/mesh-host/src/control.rs: `serve`, `client`, `client_idle`, `handle` (every request), `request`, `peek`, `inbox_counts`, `pipes`, `view`, `pipes_recs`, `programs`, `cluster`, `int`, and the reply shapes.
18
19## Tests
20
21- `tests/control.c`: over TCP against a stand-in driver: every reply shape and refusal, `programs`, `peek`, `req` bodies, the views (text and JSON), `cluster`, `snap`, `trace`, `log`, `render` and `jobs` without their threads, the 4096-byte line limit; control.rs's `an_idle_client_is_closed`.
22
23## Differences
24
25- `render` asks the jobs area's blob thread through the `mesh_control_render` hook (NULL: "the blob thread is gone").
26- Request words split on ASCII whitespace (Rust's `split_whitespace` also splits on Unicode spaces).
27
28## Licence
29
30MIT. See the repository's LICENSE.