1/* @ajax/mesh-abi-host-jobs: The jobs region: this member's replica of the fleet's job table.
2 *
3 * Part of alpha-c-mesh, a C port of alpha-rust-mesh (README.md says from where). */
4#ifndef MESH_ABI_HOST_JOBS_H
5#define MESH_ABI_HOST_JOBS_H
67#include <stdbool.h>
8#include <stddef.h>
9#include <stdint.h>
1011/* Jobs (plan F5; 0x1740..0x1780, after F4's scheduler region 0x1680..0x1720): this member's replica of the fleet's job */
12/* table and, on the leader, the dispatcher. Written by the jobs thread */
13/* (mesh-host jobd.rs) every 250 ms; a single meshd runs jobs too (its own leader). */
14#define MESH_S_JOBS 0x1740
15#define MESH_S_JOBS_ACTIVE 0x1740 /* u32 jobs submitted and not finished (committed) */
16#define MESH_S_JOBS_TOTAL 0x1744 /* u32 jobs in the table (finished ones included) */
17#define MESH_S_JOB_DONE 0x1748 /* u64 items done, every job (committed) */
18#define MESH_S_JOB_FAILED 0x1750 /* u64 items failed for good (committed) */
19#define MESH_S_JOB_LEASED 0x1758 /* u32 the leader: items in leases; another member: items it holds */
20#define MESH_S_JOB_RATE 0x175c /* f32 items/s over the last second (the leader: the fleet's; else this member's) */
21#define MESH_S_JOB_DUPES 0x1760 /* u64 duplicate results dropped (committed) */
22#define MESH_S_JOB_COMMIT 0x1768 /* u64 the job table's commit point (entries of the leader's term) */
23#define MESH_S_JOB_TERM 0x1770 /* u64 the term the table follows */
24#define MESH_S_JOB_FLAGS 0x1778 /* u32 JF_* */
25#define MESH_S_JOB_HELD 0x177c /* u32 leases this member runs */
26#define MESH_S_JOBS_END 0x1780
27#define MESH_JF_LEADER 1u /* this member leads the job table */
28#define MESH_JF_ACTIVE 2u /* the leader merged a majority's tables and dispatches */
29#define MESH_JF_PERSIST 4u /* the table is persisted (--jobs-state, or the fleet state file's .jobs) */
3031/* The Rust const asserts that only involve this package. */
32_Static_assert(MESH_S_JOB_HELD + 4 <= MESH_S_JOBS_END, "S_JOB_HELD + 4 <= S_JOBS_END");
33_Static_assert((MESH_S_JOB_DONE % 8 == 0), "S_JOB_DONE.is_multiple_of(8)");
34_Static_assert((MESH_S_JOB_DUPES % 8 == 0), "S_JOB_DUPES.is_multiple_of(8)");
35_Static_assert((MESH_S_JOB_TERM % 8 == 0), "S_JOB_TERM.is_multiple_of(8)");
3637#endif