The fleet's view records (kind key=value -- text) as text and JSON, and their parser
$ sexc add @ajax/mesh-views- 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-buf ^0.1.0, @ajax/mesh-check ^0.1.0
- dependents
- @ajax/mesh-control, @ajax/mesh-http-relay, @ajax/mesh-jobd, @ajax/mesh-shared
- keywords
- mesh alphaos views records json
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-views
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-views 2 3The fleet's view records (kind key=value -- text) as text and JSON, and their parser. 4 5The fleet's views (docs/plan-fleet-scheduling.md F6) as records. 6 7`/fleet`, `/jobs` and `/pipes` on the http port, `view fleet|jobs|pipes [json]` on the control port, and mesh-top's tabs all read one producer per view as records: 8 9member id=2 state=up leader=0 host=being gpu=cuda share=0.48 -- busy: cpu psi 0.31 10 11A record is a kind, `key=value` fields (a value has no spaces or `=`: each becomes `_`; an empty value is `-`, "none") and an optional free text after ` -- `. The text form is one record a line; the JSON form groups records by kind in first-seen order, every record an object of its fields plus "text": `-` is null, a field named in MESH_VIEWS_STRING_KEYS is a string, any other that is a JSON number is a number. 12 13```c 14#include "mesh/views.h" 15``` 16 17## Ported from 18 19[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT): crates/mesh-host/src/views.rs: `Rec` (new, kv, opt, f, text, get), `text`, `json`, `json_number`, `STRING_KEYS`, `parse`, `format_of`, `render`. 20 21## Tests 22 23- `tests/views.c`: views.rs's `records_round_trip_and_json` one for one (text form, parse back, JSON with nulls, numbers and string keys, `format_of`), plus Unicode spaces and `\r\n` lines. 24 25## Licence 26 27MIT. See the repository's LICENSE.