1/* @ajax/mesh-jobd-text: the jobs control answers, read from this member's committed table (and, on the
2 * leader, its leases, rates and picks) (jobd.rs `jobs_text`, `job_line`, `status_text`,
3 * `results_text`). */
4#ifndef MESH_JOBD_TEXT_H
5#define MESH_JOBD_TEXT_H
67#include "mesh/jobs/node.h"
89#include <stdbool.h>
10#include <stdint.h>
1112/* What the answers need besides the node: the view, whether this member is in a fleet, now (unix ms). */
13typedef struct {
14 const mj_node *node;
15 mj_view view;
16 bool peered;
17 uint64_t unix_ms;
18} mjd_text_cx;
1920/* "leader", "leader-merging", "follower" or "single". */
21const char *mjd_role(const mjd_text_cx *cx);
22/* `jobs`: the header line, one line per job, the leader's rates. A new string. */
23char *mjd_jobs_text(const mjd_text_cx *cx);
24/* One job's line (appended to out). */
25void mjd_job_line(const mjd_text_cx *cx, const mj_job *j, msb *out);
26/* `job status <id>`; false with *text the error ("no job 1.2 (committed here)"). */
27bool mjd_status_text(const mjd_text_cx *cx, mj_job_id id, char **text);
28/* `job results <id> [from] [n]`: n of the results from the from-th on. */
29bool mjd_results_text(const mjd_text_cx *cx, mj_job_id id, uint64_t from, uint64_t n, char **text);
3031#endif