@mark1russell7/harness 0.16.29 → 0.16.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/build/index.d.ts +34 -4
- package/build/index.js +81 -18
- package/build/index.js.map +1 -1
- package/build/layers.d.ts +34 -1
- package/build/layers.js +100 -1
- package/build/layers.js.map +1 -1
- package/image/lazyfs/Dockerfile +6 -2
- package/image/lazyfs/faultfs.c +452 -0
- package/image/lazyfs/start.mts +31 -6
- package/package.json +2 -1
package/build/layers.d.ts
CHANGED
|
@@ -51,4 +51,37 @@ export declare const layerOf: (topology: Topology | undefined) => Layer;
|
|
|
51
51
|
*/
|
|
52
52
|
export declare const limitsOf: (cell: {
|
|
53
53
|
readonly prediction: object;
|
|
54
|
-
}) => readonly Limit[];
|
|
54
|
+
}) => readonly Limit[];
|
|
55
|
+
/**
|
|
56
|
+
* A rig term is one pair of the space of the rig map of rigor: a fault and the layer that the fault acts on. It uses
|
|
57
|
+
* the words of that map. The rig records of this repository (`docs/rigs.json`) name these pairs.
|
|
58
|
+
*/
|
|
59
|
+
export interface RigTerm {
|
|
60
|
+
readonly fault: string;
|
|
61
|
+
readonly layer: string;
|
|
62
|
+
}
|
|
63
|
+
/** These are the environments of the rig map for the layers. E0 has no environment: it runs no lab. */
|
|
64
|
+
export declare const LAYER_RIG_ENV: Readonly<Record<Layer, string | undefined>>;
|
|
65
|
+
/**
|
|
66
|
+
* These are the rig terms of each fault name of the labs: the faults of the harness and the kinds of the triggers of
|
|
67
|
+
* `@mark1russell7/kind`. The two vocabularies share the names that they share. An empty list is a fault that the rig
|
|
68
|
+
* map has no word for at this time. Examples are a stop with its grace, a planned failover, a drain and an ICMP
|
|
69
|
+
* unreachable. The terms of `netem` and `toxic` come from the settings of the cell (`rigTermsOf`).
|
|
70
|
+
*/
|
|
71
|
+
export declare const RIG_TERMS: Readonly<Record<string, readonly RigTerm[]>>;
|
|
72
|
+
/** These are the rig terms of each type of a toxic of Toxiproxy. A slow close and a limit of bandwidth have no word in the rig map. */
|
|
73
|
+
export declare const TOXIC_RIG_TERMS: Readonly<Record<string, readonly RigTerm[]>>;
|
|
74
|
+
/** These parts of a cell tell its rig terms. A cell of kind gives the kind of its trigger as `fault`. */
|
|
75
|
+
export interface RigTermCell {
|
|
76
|
+
readonly fault: string;
|
|
77
|
+
readonly toxic?: {
|
|
78
|
+
readonly type: string;
|
|
79
|
+
} | undefined;
|
|
80
|
+
readonly netem?: string | undefined;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* This function gives the rig terms of a cell. The terms of `netem` come from the words of its setting, and the terms
|
|
84
|
+
* of `toxic` from the type of its toxic. This function throws a `RangeError` for a fault name that `RIG_TERMS` does
|
|
85
|
+
* not have, thus a new fault gets its terms in the same change.
|
|
86
|
+
*/
|
|
87
|
+
export declare function rigTermsOf(cell: RigTermCell): readonly RigTerm[];
|
package/build/layers.js
CHANGED
|
@@ -154,6 +154,105 @@ const limitsOf = (cell) => {
|
|
|
154
154
|
const laws = new Map(Object.entries(cell.prediction));
|
|
155
155
|
return LIMITS.filter((limit) => laws.get(limit) !== void 0);
|
|
156
156
|
};
|
|
157
|
-
|
|
157
|
+
/** These are the environments of the rig map for the layers. E0 has no environment: it runs no lab. */
|
|
158
|
+
const LAYER_RIG_ENV = {
|
|
159
|
+
E0: void 0,
|
|
160
|
+
E1: "container",
|
|
161
|
+
E2: "kind",
|
|
162
|
+
E3: "fabric",
|
|
163
|
+
E4: "vm",
|
|
164
|
+
E5: "vendor",
|
|
165
|
+
E6: "hardware"
|
|
166
|
+
};
|
|
167
|
+
const term = (fault, layer) => ({
|
|
168
|
+
fault,
|
|
169
|
+
layer
|
|
170
|
+
});
|
|
171
|
+
/**
|
|
172
|
+
* These are the rig terms of each fault name of the labs: the faults of the harness and the kinds of the triggers of
|
|
173
|
+
* `@mark1russell7/kind`. The two vocabularies share the names that they share. An empty list is a fault that the rig
|
|
174
|
+
* map has no word for at this time. Examples are a stop with its grace, a planned failover, a drain and an ICMP
|
|
175
|
+
* unreachable. The terms of `netem` and `toxic` come from the settings of the cell (`rigTermsOf`).
|
|
176
|
+
*/
|
|
177
|
+
const RIG_TERMS = {
|
|
178
|
+
blackhole: [term("blackhole", "L3")],
|
|
179
|
+
"freeze-process": [term("freeze", "process")],
|
|
180
|
+
rst: [term("reset", "L4")],
|
|
181
|
+
stall: [term("stall", "L3")],
|
|
182
|
+
fin: [term("kill", "process")],
|
|
183
|
+
unreachable: [],
|
|
184
|
+
simplex: [term("blackhole", "L3")],
|
|
185
|
+
"mtu-blackhole": [term("mtu", "L3")],
|
|
186
|
+
netem: [],
|
|
187
|
+
"fin-ack": [term("loss", "L4")],
|
|
188
|
+
"middlebox-forget": [term("cut", "L4")],
|
|
189
|
+
"proxy-idle": [term("cut", "L7")],
|
|
190
|
+
toxic: [],
|
|
191
|
+
"server-close": [term("cut", "L7")],
|
|
192
|
+
partition: [term("partition", "L3")],
|
|
193
|
+
"planned-failover": [],
|
|
194
|
+
"app-stall": [term("stall", "L7")],
|
|
195
|
+
"step-down": [],
|
|
196
|
+
drain: [],
|
|
197
|
+
"hop-event": [],
|
|
198
|
+
silence: [term("blackhole", "L3")],
|
|
199
|
+
none: [],
|
|
200
|
+
"pod-deletion": [],
|
|
201
|
+
"rolling-update": [],
|
|
202
|
+
"node-drain": [],
|
|
203
|
+
"scale-in": [],
|
|
204
|
+
crash: [term("kill", "process")],
|
|
205
|
+
"liveness-restart": [term("kill", "process")],
|
|
206
|
+
"peer-gone-without-close": [term("blackhole", "L3")],
|
|
207
|
+
rollout: [],
|
|
208
|
+
"cpu-throttle": [term("cpu", "process")],
|
|
209
|
+
"authorization-policy": [],
|
|
210
|
+
idle: [],
|
|
211
|
+
"ztunnel-restart": [],
|
|
212
|
+
"certificate-expiry": [term("cert-bad", "TLS")],
|
|
213
|
+
"cannot-serve": [],
|
|
214
|
+
"zone-loss": [term("node-loss", "process")],
|
|
215
|
+
latency: [term("delay", "L3")],
|
|
216
|
+
"dns-blackhole": [term("dns", "L7")]
|
|
217
|
+
};
|
|
218
|
+
/** These are the rig terms of each type of a toxic of Toxiproxy. A slow close and a limit of bandwidth have no word in the rig map. */
|
|
219
|
+
const TOXIC_RIG_TERMS = {
|
|
220
|
+
latency: [term("delay", "L4")],
|
|
221
|
+
timeout: [term("stall", "L4")],
|
|
222
|
+
reset_peer: [term("reset", "L4")],
|
|
223
|
+
slow_close: [],
|
|
224
|
+
bandwidth: [],
|
|
225
|
+
limit_data: [term("cut", "L4")],
|
|
226
|
+
slicer: [term("split-frame", "L7")]
|
|
227
|
+
};
|
|
228
|
+
/** These are the words of tc netem that the rig map names, each with its fault of the map. */
|
|
229
|
+
const NETEM_TERMS = [
|
|
230
|
+
["delay", "delay"],
|
|
231
|
+
["loss", "loss"],
|
|
232
|
+
["duplicate", "duplicate"],
|
|
233
|
+
["reorder", "reorder"],
|
|
234
|
+
["corrupt", "corrupt"]
|
|
235
|
+
];
|
|
236
|
+
/**
|
|
237
|
+
* This function gives the rig terms of a cell. The terms of `netem` come from the words of its setting, and the terms
|
|
238
|
+
* of `toxic` from the type of its toxic. This function throws a `RangeError` for a fault name that `RIG_TERMS` does
|
|
239
|
+
* not have, thus a new fault gets its terms in the same change.
|
|
240
|
+
*/
|
|
241
|
+
function rigTermsOf(cell) {
|
|
242
|
+
const own = RIG_TERMS[cell.fault];
|
|
243
|
+
if (own === void 0) throw new RangeError(`rigTermsOf: the fault ${cell.fault} has no entry in RIG_TERMS.`);
|
|
244
|
+
if (cell.fault === "netem") {
|
|
245
|
+
const words = (cell.netem ?? "").split(/\s+/);
|
|
246
|
+
return NETEM_TERMS.filter(([word]) => words.includes(word)).map(([, fault]) => term(fault, "L3"));
|
|
247
|
+
}
|
|
248
|
+
if (cell.fault === "toxic") {
|
|
249
|
+
if (cell.toxic === void 0) return [];
|
|
250
|
+
const terms = TOXIC_RIG_TERMS[cell.toxic.type];
|
|
251
|
+
if (terms === void 0) throw new RangeError(`rigTermsOf: the toxic ${cell.toxic.type} has no entry in TOXIC_RIG_TERMS.`);
|
|
252
|
+
return terms;
|
|
253
|
+
}
|
|
254
|
+
return own;
|
|
255
|
+
}
|
|
256
|
+
export { LAYERS, LAYER_FACTS, LAYER_RIG_ENV, LIMITS, RIG_TERMS, TOXIC_RIG_TERMS, layerOf, limitsOf, rigTermsOf };
|
|
158
257
|
|
|
159
258
|
//# sourceMappingURL=layers.js.map
|
package/build/layers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layers.js","names":[],"sources":["../src/layers.ts"],"sourcesContent":["import type { Fault, Topology } from \"./cell.ts\";\n\n// This module imports no `node:` module, thus a page in a browser can read the layers (`@mark1russell7/harness/layers`).\n\n/**\n * A layer is a rung of the laboratory (`docs/S7.md`). E1 is containers on one kernel, and E2 is a\n * cluster of containers on one kernel. A lab with `Topology.fabric` writes E3: routers in containers.\n * A lab in a guest of QEMU writes E4 (`substrateHere`). The other layers do not have a runner at this\n * time.\n */\nexport const LAYERS = [\"E0\", \"E1\", \"E2\", \"E3\", \"E4\", \"E5\", \"E6\"] as const;\nexport type Layer = (typeof LAYERS)[number];\n\n/** A layer state is the column \"State\" of the table of the layers in `docs/S7.md`, by its first word. */\nexport type LayerState = \"today\" | \"new\" | \"later\" | \"waiting\";\n\n/**\n * A limit is a resource that the load of a cell fills, with no fault. The five limits are the accept\n * queue, the port range, the conntrack table, the memory of a cgroup and the egress queue of an\n * interface. The name of a limit is the key of its law in `Prediction`.\n */\nexport const LIMITS = [\"queue\", \"ports\", \"conntrack\", \"memory\", \"egress\"] as const;\nexport type Limit = (typeof LIMITS)[number];\n\n/**\n * The layer facts are one row of the table of the layers in `docs/S7.md`, and what the cells of the\n * harness apply on the layer. A test holds each text equal to the table. A test of the cells holds\n * `faults` and `limits` equal to the cells of each layer.\n */\nexport interface LayerFacts {\n /** This text is the column \"What it is\". */\n readonly name: string;\n /** This text is the column \"What it proves\". */\n readonly proves: string;\n /** These texts are the column \"What it cannot prove\", one for each thing. The list is empty for \"Nothing that this plan covers\". */\n readonly cannot: readonly string[];\n /** These names are the column \"Tools\". */\n readonly tools: readonly string[];\n readonly state: LayerState;\n /**\n * These names are the faults that the cells of the layer inject, each one time. A name is in the\n * vocabulary of the lab of the layer. The cells of E1 and E3 name a `Fault` of the harness. The cells of\n * E2 are in `@mark1russell7/kind`, and they name the kind of their trigger (`TriggerKind`). The two\n * vocabularies share the names of the faults that they share, for example `blackhole` and `rst`.\n */\n readonly faults: readonly string[];\n /** These limits are the resources that the load of the cells of the layer fills, in the order of `LIMITS`. */\n readonly limits: readonly Limit[];\n}\n\n/** These are the faults of a cell of one kernel: each fault of the harness except the silence of a fabric. */\nconst ONE_KERNEL: readonly Fault[] = [\n \"blackhole\",\n \"freeze-process\",\n \"rst\",\n \"stall\",\n \"fin\",\n \"unreachable\",\n \"simplex\",\n \"mtu-blackhole\",\n \"netem\",\n \"fin-ack\",\n \"middlebox-forget\",\n \"proxy-idle\",\n \"toxic\",\n \"server-close\",\n \"partition\",\n \"planned-failover\",\n \"app-stall\",\n \"step-down\",\n \"drain\",\n \"hop-event\",\n];\n\n/** These are the faults of a cell of kind: each kind of a trigger of `@mark1russell7/kind`, in the order of `TriggerKind`. */\nconst ON_KIND: readonly string[] = [\n \"pod-deletion\",\n \"rolling-update\",\n \"node-drain\",\n \"scale-in\",\n \"crash\",\n \"liveness-restart\",\n \"freeze-process\",\n \"rst\",\n \"blackhole\",\n \"peer-gone-without-close\",\n \"app-stall\",\n \"rollout\",\n \"cpu-throttle\",\n \"authorization-policy\",\n \"idle\",\n \"ztunnel-restart\",\n \"certificate-expiry\",\n \"cannot-serve\",\n \"zone-loss\",\n \"latency\",\n \"dns-blackhole\",\n];\n\n/** These are the facts of each layer. The texts come from the table of the layers in `docs/S7.md`. */\nexport const LAYER_FACTS: Readonly<Record<Layer, LayerFacts>> = {\n E0: {\n name: \"Code on a false clock\",\n proves: \"The logic of a state machine and each order of its events\",\n cannot: [\"Any real time\"],\n tools: [\"algebra\", \"the service conformance kit\"],\n state: \"today\",\n faults: [],\n limits: [],\n },\n E1: {\n name: \"Processes and containers on one kernel\",\n proves: \"Linux TCP timers, stock servers and their clients, proxies, conntrack\",\n cannot: [\"A second kernel\", \"A separate clock\", \"A reboot\", \"A loss of power\"],\n tools: [\"The harness\"],\n state: \"today\",\n faults: ONE_KERNEL,\n limits: LIMITS,\n },\n E2: {\n name: \"A cluster of containers on one kernel\",\n proves: \"The control plane, Service rules, CNI and the lifecycle of a pod\",\n cannot: [\"A kernel for each node\", \"A loss of a node with no signal\"],\n tools: [\"kind\", \"k3d\"],\n state: \"today\",\n faults: ON_KIND,\n limits: [],\n },\n E3: {\n name: \"A routed fabric of containers on one kernel\",\n proves: \"Routing protocol timers, equal-cost paths, a change of route, sites with real delay\",\n cannot: [\"The kernel or the forwarding hardware of a router\"],\n tools: [\"containerlab with FRR\"],\n state: \"new\",\n faults: [\"blackhole\", \"stall\", \"silence\"] satisfies readonly Fault[],\n limits: [],\n },\n E4: {\n name: \"Virtual machines, each with its own kernel\",\n proves: \"A chosen kernel and HZ, a clock for each node, a loss of power, a disk, a reboot\",\n cannot: [\"A physical NIC\", \"Real zones\"],\n tools: [\"QEMU\", \"k3s in a VM\"],\n state: \"new\",\n faults: [],\n limits: [],\n },\n E5: {\n name: \"Images of vendor routers in virtual machines\",\n proves: \"The defaults and the state machines of a vendor's control plane\",\n cannot: [\"The forwarding chip of the router\"],\n tools: [\"vrnetlab\"],\n state: \"later\",\n faults: [],\n limits: [],\n },\n E6: {\n name: \"Real hardware and clouds\",\n proves: \"A physical NIC, firmware, managed load balancers, real zones\",\n cannot: [],\n tools: [\"HW-1\"],\n state: \"waiting\",\n faults: [],\n limits: [],\n },\n};\n\n/** This function gives the layer of a lab of the harness from its topology: E3 with a fabric, E1 without one. */\nexport const layerOf = (topology: Topology | undefined): Layer => (topology?.fabric === undefined ? \"E1\" : \"E3\");\n\n/**\n * This function gives the limits that the prediction of a cell names, in the order of `LIMITS`. It reads\n * a cell of the harness or of `@mark1russell7/kind`.\n */\nexport const limitsOf = (cell: { readonly prediction: object }): readonly Limit[] => {\n const laws = new Map(Object.entries(cell.prediction));\n return LIMITS.filter((limit) => laws.get(limit) !== undefined);\n};\n"],"mappings":";;;;;;;AAUA,MAAa,SAAS;CAAC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI;;;;;;AAW/D,MAAa,SAAS;CAAC;CAAS;CAAS;CAAa;CAAU;AAAQ;;AA+ExE,MAAa,cAAmD;CAC9D,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ,CAAC,eAAe;EACxB,OAAO,CAAC,WAAW,6BAA6B;EAChD,OAAO;EACP,QAAQ,CAAC;EACT,QAAQ,CAAC;CACX;CACA,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ;GAAC;GAAmB;GAAoB;GAAY;EAAiB;EAC7E,OAAO,CAAC,aAAa;EACrB,OAAO;EACP,QAAQ;GAhEV;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EA6CU;EACR,QAAQ;CACV;CACA,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ,CAAC,0BAA0B,iCAAiC;EACpE,OAAO,CAAC,QAAQ,KAAK;EACrB,OAAO;EACP,QAAQ;GAjDV;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EA6BU;EACR,QAAQ,CAAC;CACX;CACA,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ,CAAC,mDAAmD;EAC5D,OAAO,CAAC,uBAAuB;EAC/B,OAAO;EACP,QAAQ;GAAC;GAAa;GAAS;EAAS;EACxC,QAAQ,CAAC;CACX;CACA,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ,CAAC,kBAAkB,YAAY;EACvC,OAAO,CAAC,QAAQ,aAAa;EAC7B,OAAO;EACP,QAAQ,CAAC;EACT,QAAQ,CAAC;CACX;CACA,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ,CAAC,mCAAmC;EAC5C,OAAO,CAAC,UAAU;EAClB,OAAO;EACP,QAAQ,CAAC;EACT,QAAQ,CAAC;CACX;CACA,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ,CAAC;EACT,OAAO,CAAC,MAAM;EACd,OAAO;EACP,QAAQ,CAAC;EACT,QAAQ,CAAC;CACX;AACF;;AAGA,MAAa,WAAW,aAA2C,UAAU,WAAW,KAAA,IAAY,OAAO;;;;;AAM3G,MAAa,YAAY,SAA4D;CACnF,MAAM,OAAO,IAAI,IAAI,OAAO,QAAQ,KAAK,UAAU,CAAC;CACpD,OAAO,OAAO,QAAQ,UAAU,KAAK,IAAI,KAAK,MAAM,KAAA,CAAS;AAC/D"}
|
|
1
|
+
{"version":3,"file":"layers.js","names":[],"sources":["../src/layers.ts"],"sourcesContent":["import type { Fault, Topology } from \"./cell.ts\";\n\n// This module imports no `node:` module, thus a page in a browser can read the layers (`@mark1russell7/harness/layers`).\n\n/**\n * A layer is a rung of the laboratory (`docs/S7.md`). E1 is containers on one kernel, and E2 is a\n * cluster of containers on one kernel. A lab with `Topology.fabric` writes E3: routers in containers.\n * A lab in a guest of QEMU writes E4 (`substrateHere`). The other layers do not have a runner at this\n * time.\n */\nexport const LAYERS = [\"E0\", \"E1\", \"E2\", \"E3\", \"E4\", \"E5\", \"E6\"] as const;\nexport type Layer = (typeof LAYERS)[number];\n\n/** A layer state is the column \"State\" of the table of the layers in `docs/S7.md`, by its first word. */\nexport type LayerState = \"today\" | \"new\" | \"later\" | \"waiting\";\n\n/**\n * A limit is a resource that the load of a cell fills, with no fault. The five limits are the accept\n * queue, the port range, the conntrack table, the memory of a cgroup and the egress queue of an\n * interface. The name of a limit is the key of its law in `Prediction`.\n */\nexport const LIMITS = [\"queue\", \"ports\", \"conntrack\", \"memory\", \"egress\"] as const;\nexport type Limit = (typeof LIMITS)[number];\n\n/**\n * The layer facts are one row of the table of the layers in `docs/S7.md`, and what the cells of the\n * harness apply on the layer. A test holds each text equal to the table. A test of the cells holds\n * `faults` and `limits` equal to the cells of each layer.\n */\nexport interface LayerFacts {\n /** This text is the column \"What it is\". */\n readonly name: string;\n /** This text is the column \"What it proves\". */\n readonly proves: string;\n /** These texts are the column \"What it cannot prove\", one for each thing. The list is empty for \"Nothing that this plan covers\". */\n readonly cannot: readonly string[];\n /** These names are the column \"Tools\". */\n readonly tools: readonly string[];\n readonly state: LayerState;\n /**\n * These names are the faults that the cells of the layer inject, each one time. A name is in the\n * vocabulary of the lab of the layer. The cells of E1 and E3 name a `Fault` of the harness. The cells of\n * E2 are in `@mark1russell7/kind`, and they name the kind of their trigger (`TriggerKind`). The two\n * vocabularies share the names of the faults that they share, for example `blackhole` and `rst`.\n */\n readonly faults: readonly string[];\n /** These limits are the resources that the load of the cells of the layer fills, in the order of `LIMITS`. */\n readonly limits: readonly Limit[];\n}\n\n/** These are the faults of a cell of one kernel: each fault of the harness except the silence of a fabric. */\nconst ONE_KERNEL: readonly Fault[] = [\n \"blackhole\",\n \"freeze-process\",\n \"rst\",\n \"stall\",\n \"fin\",\n \"unreachable\",\n \"simplex\",\n \"mtu-blackhole\",\n \"netem\",\n \"fin-ack\",\n \"middlebox-forget\",\n \"proxy-idle\",\n \"toxic\",\n \"server-close\",\n \"partition\",\n \"planned-failover\",\n \"app-stall\",\n \"step-down\",\n \"drain\",\n \"hop-event\",\n];\n\n/** These are the faults of a cell of kind: each kind of a trigger of `@mark1russell7/kind`, in the order of `TriggerKind`. */\nconst ON_KIND: readonly string[] = [\n \"pod-deletion\",\n \"rolling-update\",\n \"node-drain\",\n \"scale-in\",\n \"crash\",\n \"liveness-restart\",\n \"freeze-process\",\n \"rst\",\n \"blackhole\",\n \"peer-gone-without-close\",\n \"app-stall\",\n \"rollout\",\n \"cpu-throttle\",\n \"authorization-policy\",\n \"idle\",\n \"ztunnel-restart\",\n \"certificate-expiry\",\n \"cannot-serve\",\n \"zone-loss\",\n \"latency\",\n \"dns-blackhole\",\n];\n\n/** These are the facts of each layer. The texts come from the table of the layers in `docs/S7.md`. */\nexport const LAYER_FACTS: Readonly<Record<Layer, LayerFacts>> = {\n E0: {\n name: \"Code on a false clock\",\n proves: \"The logic of a state machine and each order of its events\",\n cannot: [\"Any real time\"],\n tools: [\"algebra\", \"the service conformance kit\"],\n state: \"today\",\n faults: [],\n limits: [],\n },\n E1: {\n name: \"Processes and containers on one kernel\",\n proves: \"Linux TCP timers, stock servers and their clients, proxies, conntrack\",\n cannot: [\"A second kernel\", \"A separate clock\", \"A reboot\", \"A loss of power\"],\n tools: [\"The harness\"],\n state: \"today\",\n faults: ONE_KERNEL,\n limits: LIMITS,\n },\n E2: {\n name: \"A cluster of containers on one kernel\",\n proves: \"The control plane, Service rules, CNI and the lifecycle of a pod\",\n cannot: [\"A kernel for each node\", \"A loss of a node with no signal\"],\n tools: [\"kind\", \"k3d\"],\n state: \"today\",\n faults: ON_KIND,\n limits: [],\n },\n E3: {\n name: \"A routed fabric of containers on one kernel\",\n proves: \"Routing protocol timers, equal-cost paths, a change of route, sites with real delay\",\n cannot: [\"The kernel or the forwarding hardware of a router\"],\n tools: [\"containerlab with FRR\"],\n state: \"new\",\n faults: [\"blackhole\", \"stall\", \"silence\"] satisfies readonly Fault[],\n limits: [],\n },\n E4: {\n name: \"Virtual machines, each with its own kernel\",\n proves: \"A chosen kernel and HZ, a clock for each node, a loss of power, a disk, a reboot\",\n cannot: [\"A physical NIC\", \"Real zones\"],\n tools: [\"QEMU\", \"k3s in a VM\"],\n state: \"new\",\n faults: [],\n limits: [],\n },\n E5: {\n name: \"Images of vendor routers in virtual machines\",\n proves: \"The defaults and the state machines of a vendor's control plane\",\n cannot: [\"The forwarding chip of the router\"],\n tools: [\"vrnetlab\"],\n state: \"later\",\n faults: [],\n limits: [],\n },\n E6: {\n name: \"Real hardware and clouds\",\n proves: \"A physical NIC, firmware, managed load balancers, real zones\",\n cannot: [],\n tools: [\"HW-1\"],\n state: \"waiting\",\n faults: [],\n limits: [],\n },\n};\n\n/** This function gives the layer of a lab of the harness from its topology: E3 with a fabric, E1 without one. */\nexport const layerOf = (topology: Topology | undefined): Layer => (topology?.fabric === undefined ? \"E1\" : \"E3\");\n\n/**\n * This function gives the limits that the prediction of a cell names, in the order of `LIMITS`. It reads\n * a cell of the harness or of `@mark1russell7/kind`.\n */\nexport const limitsOf = (cell: { readonly prediction: object }): readonly Limit[] => {\n const laws = new Map(Object.entries(cell.prediction));\n return LIMITS.filter((limit) => laws.get(limit) !== undefined);\n};\n\n/**\n * A rig term is one pair of the space of the rig map of rigor: a fault and the layer that the fault acts on. It uses\n * the words of that map. The rig records of this repository (`docs/rigs.json`) name these pairs.\n */\nexport interface RigTerm {\n readonly fault: string;\n readonly layer: string;\n}\n\n/** These are the environments of the rig map for the layers. E0 has no environment: it runs no lab. */\nexport const LAYER_RIG_ENV: Readonly<Record<Layer, string | undefined>> = {\n E0: undefined,\n E1: \"container\",\n E2: \"kind\",\n E3: \"fabric\",\n E4: \"vm\",\n E5: \"vendor\",\n E6: \"hardware\",\n};\n\nconst term = (fault: string, layer: string): RigTerm => ({ fault, layer });\n\n/**\n * These are the rig terms of each fault name of the labs: the faults of the harness and the kinds of the triggers of\n * `@mark1russell7/kind`. The two vocabularies share the names that they share. An empty list is a fault that the rig\n * map has no word for at this time. Examples are a stop with its grace, a planned failover, a drain and an ICMP\n * unreachable. The terms of `netem` and `toxic` come from the settings of the cell (`rigTermsOf`).\n */\nexport const RIG_TERMS: Readonly<Record<string, readonly RigTerm[]>> = {\n // The faults of the harness.\n blackhole: [term(\"blackhole\", \"L3\")],\n \"freeze-process\": [term(\"freeze\", \"process\")],\n rst: [term(\"reset\", \"L4\")],\n stall: [term(\"stall\", \"L3\")],\n fin: [term(\"kill\", \"process\")],\n unreachable: [],\n simplex: [term(\"blackhole\", \"L3\")],\n \"mtu-blackhole\": [term(\"mtu\", \"L3\")],\n netem: [],\n \"fin-ack\": [term(\"loss\", \"L4\")],\n \"middlebox-forget\": [term(\"cut\", \"L4\")],\n \"proxy-idle\": [term(\"cut\", \"L7\")],\n toxic: [],\n \"server-close\": [term(\"cut\", \"L7\")],\n partition: [term(\"partition\", \"L3\")],\n \"planned-failover\": [],\n \"app-stall\": [term(\"stall\", \"L7\")],\n \"step-down\": [],\n drain: [],\n \"hop-event\": [],\n silence: [term(\"blackhole\", \"L3\")],\n // A calibration cell injects nothing.\n none: [],\n // The kinds of the triggers of kind that the harness does not name.\n \"pod-deletion\": [],\n \"rolling-update\": [],\n \"node-drain\": [],\n \"scale-in\": [],\n crash: [term(\"kill\", \"process\")],\n \"liveness-restart\": [term(\"kill\", \"process\")],\n \"peer-gone-without-close\": [term(\"blackhole\", \"L3\")],\n rollout: [],\n \"cpu-throttle\": [term(\"cpu\", \"process\")],\n \"authorization-policy\": [],\n idle: [],\n \"ztunnel-restart\": [],\n \"certificate-expiry\": [term(\"cert-bad\", \"TLS\")],\n \"cannot-serve\": [],\n \"zone-loss\": [term(\"node-loss\", \"process\")],\n latency: [term(\"delay\", \"L3\")],\n \"dns-blackhole\": [term(\"dns\", \"L7\")],\n};\n\n/** These are the rig terms of each type of a toxic of Toxiproxy. A slow close and a limit of bandwidth have no word in the rig map. */\nexport const TOXIC_RIG_TERMS: Readonly<Record<string, readonly RigTerm[]>> = {\n latency: [term(\"delay\", \"L4\")],\n timeout: [term(\"stall\", \"L4\")],\n reset_peer: [term(\"reset\", \"L4\")],\n slow_close: [],\n bandwidth: [],\n limit_data: [term(\"cut\", \"L4\")],\n slicer: [term(\"split-frame\", \"L7\")],\n};\n\n/** These are the words of tc netem that the rig map names, each with its fault of the map. */\nconst NETEM_TERMS: readonly (readonly [string, string])[] = [\n [\"delay\", \"delay\"],\n [\"loss\", \"loss\"],\n [\"duplicate\", \"duplicate\"],\n [\"reorder\", \"reorder\"],\n [\"corrupt\", \"corrupt\"],\n];\n\n/** These parts of a cell tell its rig terms. A cell of kind gives the kind of its trigger as `fault`. */\nexport interface RigTermCell {\n readonly fault: string;\n readonly toxic?: { readonly type: string } | undefined;\n readonly netem?: string | undefined;\n}\n\n/**\n * This function gives the rig terms of a cell. The terms of `netem` come from the words of its setting, and the terms\n * of `toxic` from the type of its toxic. This function throws a `RangeError` for a fault name that `RIG_TERMS` does\n * not have, thus a new fault gets its terms in the same change.\n */\nexport function rigTermsOf(cell: RigTermCell): readonly RigTerm[] {\n const own = RIG_TERMS[cell.fault];\n if (own === undefined) throw new RangeError(`rigTermsOf: the fault ${cell.fault} has no entry in RIG_TERMS.`);\n if (cell.fault === \"netem\") {\n const words = (cell.netem ?? \"\").split(/\\s+/);\n return NETEM_TERMS.filter(([word]) => words.includes(word)).map(([, fault]) => term(fault, \"L3\"));\n }\n if (cell.fault === \"toxic\") {\n if (cell.toxic === undefined) return [];\n const terms = TOXIC_RIG_TERMS[cell.toxic.type];\n if (terms === undefined) throw new RangeError(`rigTermsOf: the toxic ${cell.toxic.type} has no entry in TOXIC_RIG_TERMS.`);\n return terms;\n }\n return own;\n}\n"],"mappings":";;;;;;;AAUA,MAAa,SAAS;CAAC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI;;;;;;AAW/D,MAAa,SAAS;CAAC;CAAS;CAAS;CAAa;CAAU;AAAQ;;AA+ExE,MAAa,cAAmD;CAC9D,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ,CAAC,eAAe;EACxB,OAAO,CAAC,WAAW,6BAA6B;EAChD,OAAO;EACP,QAAQ,CAAC;EACT,QAAQ,CAAC;CACX;CACA,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ;GAAC;GAAmB;GAAoB;GAAY;EAAiB;EAC7E,OAAO,CAAC,aAAa;EACrB,OAAO;EACP,QAAQ;GAhEV;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA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1.10.0), and checks the SHA-256 of
|
|
5
5
|
# each before it builds. Thus the build fetches nothing that the file does not pin.
|
|
6
6
|
#
|
|
7
|
+
# The build also compiles faultfs.c: the fault layer above LazyFS, for the kinds fsync-error, full and slow.
|
|
8
|
+
#
|
|
7
9
|
# The runtime stage has Node.js 24, thus a subject writes its files with node:sqlite or with node:fs.
|
|
8
10
|
# The container needs /dev/fuse and the capability of a mount: the disk tier starts it privileged.
|
|
9
11
|
FROM node:24.21.0-bookworm-slim@sha256:d6aa754f16b3197301076f047b5def2f02ea1dbbc2ca920407d46d7ec7f87b20 AS build
|
|
10
12
|
RUN apt-get update \
|
|
11
|
-
&& apt-get install -y --no-install-recommends g++ make cmake libfuse3-dev curl ca-certificates \
|
|
13
|
+
&& apt-get install -y --no-install-recommends gcc g++ make cmake pkg-config libfuse3-dev curl ca-certificates \
|
|
12
14
|
&& rm -rf /var/lib/apt/lists/*
|
|
13
15
|
ARG LAZYFS=3edad01aa936b81fed9bd64e47e725fc5ef6c977
|
|
14
16
|
ARG LAZYFS_SHA256=9c5004c4f704f059120daa2934a38a45002bda67ebd9e2d16a066a3499f5959d
|
|
@@ -38,13 +40,15 @@ RUN cd libs/libpcache/build \
|
|
|
38
40
|
&& mkdir -p /out/bin /out/lib \
|
|
39
41
|
&& install -m 0755 lazyfs /out/bin/lazyfs \
|
|
40
42
|
&& cp -a /src/libs/libpcache/build/libpcache.so* /out/lib/
|
|
43
|
+
COPY harness/image/lazyfs/faultfs.c /src/faultfs/faultfs.c
|
|
44
|
+
RUN gcc -O2 -Wall -Wextra -o /out/bin/faultfs /src/faultfs/faultfs.c $(pkg-config fuse3 --cflags --libs) -lpthread
|
|
41
45
|
|
|
42
46
|
FROM node:24.21.0-bookworm-slim@sha256:d6aa754f16b3197301076f047b5def2f02ea1dbbc2ca920407d46d7ec7f87b20
|
|
43
47
|
RUN apt-get update \
|
|
44
48
|
&& apt-get install -y --no-install-recommends fuse3 \
|
|
45
49
|
&& rm -rf /var/lib/apt/lists/* \
|
|
46
50
|
&& sed -i 's/^#user_allow_other/user_allow_other/' /etc/fuse.conf \
|
|
47
|
-
&& mkdir -p /etc/lazyfs /run/lazyfs /var/disk /mnt/disk /opt/subject
|
|
51
|
+
&& mkdir -p /etc/lazyfs /run/lazyfs /run/faultfs /var/disk /mnt/lazy /mnt/disk /opt/subject
|
|
48
52
|
COPY --from=build /out/bin/ /usr/local/bin/
|
|
49
53
|
# A copy of a folder keeps the links of the library (libpcache.so to libpcache.so.0)
|
|
50
54
|
COPY --from=build /out/lib/ /usr/local/lib/
|