schedr_model/logs.rs
1//! The worker's log endpoint as both sides see it (the worker serves it, the webserver
2//! reads it; see archive/PROJECT.md, Task logs).
3
4/// The header naming the worker that answered.
5pub const WORKER_ID_HEADER: &str = "schedr-worker-id";
6
7/// The header with the log's size in bytes when it was read.
8pub const LOG_SIZE_HEADER: &str = "schedr-log-size";
9
10/// The header saying whether the attempt still runs on the worker (`true` / `false`).
11pub const RUNNING_HEADER: &str = "schedr-attempt-running";
12
13/// The most bytes one request returns (and the default).
14pub const MAX_CHUNK: u64 = 1 << 20;
15
16/// How many bytes before a part of a log the webserver reads too, masking them with the part
17/// and not showing them: a value begun there (a quoted one going on over lines) is hidden in
18/// the part too (decision 131).
19pub const MASK_CONTEXT: u64 = 64 * 1024;
20
21/// The most bytes a worker's log endpoint returns at once: a part and the bytes before it.
22pub const MAX_READ: u64 = MAX_CHUNK + MASK_CONTEXT;
23
24/// The fewest bytes one request returns when asked for less: one UTF-8 character, so a part
25/// always moves a reader on.
26pub const MIN_CHUNK: u64 = 4;
27
28#[cfg(test)]
29mod tests;