1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! What:
//! Small shared building blocks:
//! private files,
//! scratch locations,
//! JSON,
//! time,
//! random ids,
//! paths and bounded parallelism.
//! Why:
//! Subsystems depend on these and they depend on no subsystem.
//!
//! In TS you'd write (pseudocode):
//! ```ts
//! // foundation/index.ts: one `export * from './file'` per module below.
//! ```
/// Private,
/// crash-safe file primitives shared by every durable record.
/// Where short-lived private files live:
/// the per-user scratch directory and the repository scratch directory,
/// never the system temporary directory.
/// Compact JSON records read and written with the incumbent's `JSON` semantics.
/// Random identifiers in the layout of the incumbent's `randomUUID`.
/// Text operations with the exact semantics of JavaScript's built-ins.
/// Line-oriented debug and warning diagnostics on standard error.
/// UTC timestamps in the exact form of JavaScript's `toISOString`.
/// Lexical path normalization.
/// How many workers independent items may use together, from the CPUs allowed, the memory free and a measured ceiling.
/// Independent items on a bounded number of threads, reported in input order with no lock.