1# @ajax/mesh-jobs-table
23The job table: every job with what is known of it (done items, results, runs of done items without
4results, failures, retries counted, duplicates, cancel and finish, per-member counts, the fold of an
5endless job's runs, its presentation word), changed only by applying ops (@ajax/mesh-jobs-op).
67The table is a join-semilattice: every op is idempotent, and applying two tables' ops in either order
8gives their union, in which an item's first result wins. That is why a new leader of the fleet can
9merge a majority's tables without matching their logs (`@ajax/mesh-jobs-merge`).
1011## Ported from
1213[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT):
14`crates/mesh-host/src/jobs.rs`: `FIN_*`, `Job` (`fold`, `total`, `settled`, `lease_of`, `active`,
15`complete`, `state`, `left`), `Table` (`apply`, `ops`, `next_id`).
1617## Tests
1819- `tests/table.c`, the Rust's `ops_frames_and_the_merge`, table half: the ops round trip,
20 idempotence, the union in either order, a table rebuilt from its own ops, and `lease_of`.
21- `tests/table.c`, golden: four random sequences of 600 ops (every kind, folds and forgets included).
22 The identical generator runs in the Rust, and every 50 ops the hash and length of the encoded table
23 match the Rust's. So does the table rebuilt from its own ops, and whether it equals the original.
24 Then the whole sequence and `next_id` are compared.
2526## Licence
2728MIT. See the repository's LICENSE.