skip to content
[readonly]
==> src/jobs_thread.h <==
1/* The jobs thread's state (jobd.rs `Jobd`). */
2#ifndef MESH_JOBD_JOBS_THREAD_H
3#define MESH_JOBD_JOBS_THREAD_H
4#include "internal.h"
5#include "mesh/omap.h"
6
7typedef struct {
8    mjd *d;
9    mesh_shared *sh;
10    mj_node *node;
11    mj_disk disk;
12    int64_t t0;
13    bool peered;
14    momap *replies; /* token -> jd_reply */
15    uint64_t token;
16    int64_t progs_at;
17    mesh_reply *progs; /* the driver's JOB_PROGS answer awaited */
18    int64_t publish_at;
19    /* Per job: its done count over the last few seconds (the view's items/s and ETA). */
20    momap *hist; /* job -> jd_hist */
21    /* Per watched image: the items whose committed results blobd has. */
22    momap *sent; /* job -> mj_ranges */
23    /* Forgotten jobs blobd was told of (each once a process, so a job forgotten while this member was
24     * down -- replayed from the log -- is told at the start and its blobs here go too). */
25    momap *told; /* job -> (nothing) */
26    /* Leases refused while blobd holds too many of our payloads in memory (logged on a change). */
27    bool throttled;
28} jd;
29
30typedef struct {
31    int64_t *at; /* mono ns */
32    uint64_t *done;
33    size_t n, cap;
34} jd_hist;
35
36uint64_t jd_unix_ms(void);
37mj_view jd_view(const jd *x);
38/* The host block, the jobs view's records, blobd's news (every 250 ms). */
39void jd_publish(jd *x);
40/* The jobs view's records (exposed for the tests through jd_publish's result in sh->jobs_view_recs). */
41mesh_recs jd_jobs_recs(jd *x, double rate);
42
43#endif