skip to content
==> 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.