rightsize 0.7.9 → 0.7.12
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 +6 -4
- package/dist/backend-docker/backend.d.ts +29 -3
- package/dist/backend-docker/backend.d.ts.map +1 -1
- package/dist/backend-docker/backend.js +30 -3
- package/dist/backend-docker/backend.js.map +1 -1
- package/dist/backend-msb/backend.d.ts +657 -83
- package/dist/backend-msb/backend.d.ts.map +1 -1
- package/dist/backend-msb/backend.js +1319 -149
- package/dist/backend-msb/backend.js.map +1 -1
- package/dist/backend-msb/commands.d.ts +162 -16
- package/dist/backend-msb/commands.d.ts.map +1 -1
- package/dist/backend-msb/commands.js +228 -32
- package/dist/backend-msb/commands.js.map +1 -1
- package/dist/backend-msb/network-links.d.ts +86 -1
- package/dist/backend-msb/network-links.d.ts.map +1 -1
- package/dist/backend-msb/network-links.js +119 -4
- package/dist/backend-msb/network-links.js.map +1 -1
- package/dist/backend-msb/provisioner.d.ts +1 -1
- package/dist/backend-msb/provisioner.d.ts.map +1 -1
- package/dist/backend-msb/provisioner.js +1 -1
- package/dist/backend-msb/provisioner.js.map +1 -1
- package/dist/backend-msb/restore-access-denied.d.ts +50 -0
- package/dist/backend-msb/restore-access-denied.d.ts.map +1 -0
- package/dist/backend-msb/restore-access-denied.js +52 -0
- package/dist/backend-msb/restore-access-denied.js.map +1 -0
- package/dist/backend-msb/restore-broker.d.ts +181 -0
- package/dist/backend-msb/restore-broker.d.ts.map +1 -0
- package/dist/backend-msb/restore-broker.js +264 -0
- package/dist/backend-msb/restore-broker.js.map +1 -0
- package/dist/backend-msb/sandbox-already-exists.d.ts +32 -0
- package/dist/backend-msb/sandbox-already-exists.d.ts.map +1 -0
- package/dist/backend-msb/sandbox-already-exists.js +35 -0
- package/dist/backend-msb/sandbox-already-exists.js.map +1 -0
- package/dist/backend-msb/snapshot-create.d.ts +22 -0
- package/dist/backend-msb/snapshot-create.d.ts.map +1 -0
- package/dist/backend-msb/snapshot-create.js +33 -0
- package/dist/backend-msb/snapshot-create.js.map +1 -0
- package/dist/backend-msb/snapshot-import.d.ts +30 -14
- package/dist/backend-msb/snapshot-import.d.ts.map +1 -1
- package/dist/backend-msb/snapshot-import.js +35 -17
- package/dist/backend-msb/snapshot-import.js.map +1 -1
- package/dist/backend-msb/snapshot-rm.d.ts +28 -0
- package/dist/backend-msb/snapshot-rm.d.ts.map +1 -0
- package/dist/backend-msb/snapshot-rm.js +30 -0
- package/dist/backend-msb/snapshot-rm.js.map +1 -0
- package/dist/core/backend.d.ts +68 -23
- package/dist/core/backend.d.ts.map +1 -1
- package/dist/core/checkpoint/api.d.ts +2 -2
- package/dist/core/checkpoint/api.js +2 -2
- package/dist/core/checkpoint/registry.d.ts +46 -0
- package/dist/core/checkpoint/registry.d.ts.map +1 -1
- package/dist/core/checkpoint/registry.js +44 -3
- package/dist/core/checkpoint/registry.js.map +1 -1
- package/dist/core/errors.d.ts +49 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +61 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/free-ports.d.ts +18 -0
- package/dist/core/free-ports.d.ts.map +1 -1
- package/dist/core/free-ports.js +61 -0
- package/dist/core/free-ports.js.map +1 -1
- package/dist/core/generic-container.d.ts +101 -12
- package/dist/core/generic-container.d.ts.map +1 -1
- package/dist/core/generic-container.js +399 -71
- package/dist/core/generic-container.js.map +1 -1
- package/dist/core/model.d.ts +40 -3
- package/dist/core/model.d.ts.map +1 -1
- package/dist/core/network.d.ts +6 -2
- package/dist/core/network.d.ts.map +1 -1
- package/dist/core/network.js +4 -1
- package/dist/core/network.js.map +1 -1
- package/dist/core/reuse/hash.d.ts +12 -0
- package/dist/core/reuse/hash.d.ts.map +1 -1
- package/dist/core/reuse/hash.js +1 -0
- package/dist/core/reuse/hash.js.map +1 -1
- package/dist/core/reuse/registry.d.ts +10 -1
- package/dist/core/reuse/registry.d.ts.map +1 -1
- package/dist/core/reuse/registry.js +15 -1
- package/dist/core/reuse/registry.js.map +1 -1
- package/dist/core/sandbox-name.d.ts +3 -0
- package/dist/core/sandbox-name.d.ts.map +1 -0
- package/dist/core/sandbox-name.js +19 -0
- package/dist/core/sandbox-name.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/cassandra.d.ts +12 -12
- package/dist/modules/cassandra.js +13 -13
- package/dist/modules/cassandra.js.map +1 -1
- package/dist/modules/minio.d.ts +5 -3
- package/dist/modules/minio.d.ts.map +1 -1
- package/dist/modules/minio.js +14 -4
- package/dist/modules/minio.js.map +1 -1
- package/dist/modules/postgres.d.ts +2 -2
- package/dist/modules/postgres.d.ts.map +1 -1
- package/dist/modules/postgres.js +11 -9
- package/dist/modules/postgres.js.map +1 -1
- package/package.json +1 -1
- package/dist/backend-msb/snapshot-list.d.ts +0 -43
- package/dist/backend-msb/snapshot-list.d.ts.map +0 -1
- package/dist/backend-msb/snapshot-list.js +0 -53
- package/dist/backend-msb/snapshot-list.js.map +0 -1
|
@@ -39,6 +39,14 @@ export function isCheckpointRegistrySpec(value) {
|
|
|
39
39
|
if (!Array.isArray(exposedPorts) || !exposedPorts.every((p) => typeof p === "number")) {
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
42
|
+
// Additive and optional (see CheckpointRegistrySpec's own doc): an entry
|
|
43
|
+
// written before UDP exposure existed simply omits the key, which reads as
|
|
44
|
+
// "no UDP ports" — only a PRESENT-but-malformed value (not an array of
|
|
45
|
+
// numbers) is corrupt.
|
|
46
|
+
const exposedUdpPorts = rec["exposedUdpPorts"];
|
|
47
|
+
if (exposedUdpPorts !== undefined && !(Array.isArray(exposedUdpPorts) && exposedUdpPorts.every((p) => typeof p === "number"))) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
42
50
|
const memoryLimitMb = rec["memoryLimitMb"];
|
|
43
51
|
if (memoryLimitMb !== null && typeof memoryLimitMb !== "number") {
|
|
44
52
|
return false;
|
|
@@ -56,6 +64,13 @@ function isCheckpointRegistryEntry(value) {
|
|
|
56
64
|
typeof rec["createdIso"] !== "string") {
|
|
57
65
|
return false;
|
|
58
66
|
}
|
|
67
|
+
// Additive and optional (see CheckpointRegistryEntry's own doc): an entry
|
|
68
|
+
// written before this field existed simply omits the key, which is fine —
|
|
69
|
+
// only a PRESENT-but-malformed value (not an array of strings) is corrupt.
|
|
70
|
+
const capturedCommand = rec["capturedCommand"];
|
|
71
|
+
if (capturedCommand !== undefined && !(Array.isArray(capturedCommand) && capturedCommand.every((c) => typeof c === "string"))) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
59
74
|
return isCheckpointRegistrySpec(rec["spec"]);
|
|
60
75
|
}
|
|
61
76
|
/**
|
|
@@ -143,11 +158,16 @@ export function toCheckpointRegistrySpec(spec) {
|
|
|
143
158
|
for (const [key, value] of spec.env) {
|
|
144
159
|
env[key] = value;
|
|
145
160
|
}
|
|
161
|
+
const exposedUdpPorts = spec.ports.filter((p) => p.protocol === "udp").map((p) => p.guestPort);
|
|
146
162
|
return {
|
|
147
163
|
env,
|
|
148
164
|
command: spec.command ?? null,
|
|
149
|
-
exposedPorts: spec.ports.map((p) => p.guestPort),
|
|
165
|
+
exposedPorts: spec.ports.filter((p) => p.protocol === "tcp").map((p) => p.guestPort),
|
|
150
166
|
memoryLimitMb: spec.memoryLimitMb ?? null,
|
|
167
|
+
// Omitted (not an empty array) when there are none — a spec that never
|
|
168
|
+
// exposes a UDP port serializes exactly as it did before this field
|
|
169
|
+
// existed.
|
|
170
|
+
...(exposedUdpPorts.length > 0 ? { exposedUdpPorts } : {}),
|
|
151
171
|
};
|
|
152
172
|
}
|
|
153
173
|
/**
|
|
@@ -163,14 +183,31 @@ export function toCheckpointRegistrySpec(spec) {
|
|
|
163
183
|
* pointing at itself. `diskLimitMb`/`tmpfsRootMb`/`networkDisabled` are
|
|
164
184
|
* placeholders too — the registry's pinned `CheckpointRegistrySpec` shape
|
|
165
185
|
* doesn't carry them, same as it never carried `keepAlive`.
|
|
186
|
+
*
|
|
187
|
+
* `command` resolves with `entry.capturedCommand` as its fallback: when the
|
|
188
|
+
* source container had an explicit command, `entry.spec.command` already
|
|
189
|
+
* carries it and `capturedCommand` (never set for that case) never enters
|
|
190
|
+
* into it; when it did not, this substitutes whatever guest cmdline
|
|
191
|
+
* `checkpoint()` captured, so the restored `ContainerSpec`'s `command` is
|
|
192
|
+
* already the fully-resolved workload argv a restore-side backend (msb)
|
|
193
|
+
* needs to revive it, with no separate lookup needed at restore time. When
|
|
194
|
+
* NEITHER is present (an entry written before capture existed, or one whose
|
|
195
|
+
* capture attempt itself failed), `command` stays `undefined` exactly as
|
|
196
|
+
* before, and it is the restoring backend's own job to refuse rather than
|
|
197
|
+
* boot that sandbox silently idle (see `MsbCliBackend.bootRestoreOnce`).
|
|
166
198
|
*/
|
|
167
199
|
export function fromCheckpointRegistryEntry(entry) {
|
|
168
200
|
return {
|
|
169
201
|
name: entry.name,
|
|
170
202
|
image: entry.ref,
|
|
171
203
|
env: envRecordToPairs(entry.spec.env),
|
|
172
|
-
command: entry.spec.command ?? undefined,
|
|
173
|
-
ports:
|
|
204
|
+
command: entry.spec.command ?? entry.capturedCommand ?? undefined,
|
|
205
|
+
ports: [
|
|
206
|
+
...entry.spec.exposedPorts.map((guestPort) => ({ hostPort: 0, guestPort, protocol: "tcp" })),
|
|
207
|
+
// Absent on an entry written before UDP exposure existed — normalizes
|
|
208
|
+
// to no UDP ports, never a corrupt read (see isCheckpointRegistrySpec).
|
|
209
|
+
...(entry.spec.exposedUdpPorts ?? []).map((guestPort) => ({ hostPort: 0, guestPort, protocol: "udp" })),
|
|
210
|
+
],
|
|
174
211
|
mounts: [],
|
|
175
212
|
networkId: undefined,
|
|
176
213
|
aliases: [],
|
|
@@ -181,6 +218,10 @@ export function fromCheckpointRegistryEntry(entry) {
|
|
|
181
218
|
diskLimitMb: undefined,
|
|
182
219
|
tmpfsRootMb: undefined,
|
|
183
220
|
networkDisabled: false,
|
|
221
|
+
// Per-run wiring, never persisted — same placeholder treatment as
|
|
222
|
+
// networkDisabled/diskLimitMb/tmpfsRootMb above (see ContainerSpec's own
|
|
223
|
+
// doc on why this is never part of a checkpoint's identity).
|
|
224
|
+
hostUdpEgressPorts: [],
|
|
184
225
|
};
|
|
185
226
|
}
|
|
186
227
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/core/checkpoint/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/core/checkpoint/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAsEvD,mGAAmG;AACnG,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAgB,EAAE,IAAY;IACnE,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;AAC7D,CAAC;AAED,wKAAwK;AACxK,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC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AI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAc,EAAE,CAAC,CAAC;SACjH;QACD,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,EAAE;QACT,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,SAAS;QACpD,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,KAAK,CAAC,GAAG;QACxB,WAAW,EAAE,SAAS;QACtB,WAAW,EAAE,SAAS;QACtB,eAAe,EAAE,KAAK;QACtB,kEAAkE;QAClE,yEAAyE;QACzE,6DAA6D;QAC7D,kBAAkB,EAAE,EAAE;KACvB,CAAC;AACJ,CAAC"}
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -119,6 +119,34 @@ export declare class CheckpointBackendMismatchError extends Error {
|
|
|
119
119
|
export declare class ReuseFromCheckpointError extends Error {
|
|
120
120
|
constructor();
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Thrown at `start()` when a container built via `GenericContainer.fromCheckpoint()`
|
|
124
|
+
* carries an env that no longer matches the checkpoint's own captured env —
|
|
125
|
+
* an extra `withEnv()` call, or one overriding a key the checkpoint already
|
|
126
|
+
* set — and the active backend has no way to apply that at restore time.
|
|
127
|
+
*
|
|
128
|
+
* msb is the one backend this affects: 0.7.1 replaced `run --from-snapshot`
|
|
129
|
+
* with a dedicated `msb restore` command that has no `-e`/`--env` flag at
|
|
130
|
+
* all (a disk-only restore replays the sandbox's own captured
|
|
131
|
+
* configuration). Before 0.7.1, an overridden or extended env silently
|
|
132
|
+
* reached the restored guest via `run -e`; since there is now no msb
|
|
133
|
+
* invocation this library could emit that would honor it, silently dropping
|
|
134
|
+
* it would let the workload boot with env the caller never asked for and
|
|
135
|
+
* without env it did ask for — a correctness bug, not a graceful
|
|
136
|
+
* degradation — so this throws instead, before any backend call. Restoring
|
|
137
|
+
* with the checkpoint's own env completely unchanged never hits this: only
|
|
138
|
+
* a call that actually changes what would be sent does. docker is
|
|
139
|
+
* unaffected — restoring there is an ordinary `docker create`/`run` against
|
|
140
|
+
* the committed image with a fresh env array, so this is never thrown when
|
|
141
|
+
* the active backend is `"docker"`.
|
|
142
|
+
*/
|
|
143
|
+
export declare class CheckpointRestoreEnvOverrideError extends Error {
|
|
144
|
+
/** The active backend's name — always `"microsandbox"` today, the one backend this affects. */
|
|
145
|
+
readonly backend: string;
|
|
146
|
+
constructor(
|
|
147
|
+
/** The active backend's name — always `"microsandbox"` today, the one backend this affects. */
|
|
148
|
+
backend: string);
|
|
149
|
+
}
|
|
122
150
|
/**
|
|
123
151
|
* Thrown by `copyFileToContainer`/`copyContentToContainer`/
|
|
124
152
|
* `copyFileFromContainer` when `containerPath` is not absolute — both
|
|
@@ -251,4 +279,25 @@ export declare class NetworkDisabledConflictError extends Error {
|
|
|
251
279
|
export declare class TmpfsRootCheckpointError extends Error {
|
|
252
280
|
constructor();
|
|
253
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Thrown restoring a microsandbox checkpoint whose source container had no
|
|
284
|
+
* explicit command (the image's own default entrypoint was running) and
|
|
285
|
+
* whose registry entry carries no captured workload cmdline either —
|
|
286
|
+
* `msb restore` boots a restored sandbox with only its guest agent inside
|
|
287
|
+
* and never re-runs anything on its own (EMPIRICALLY VERIFIED against msb
|
|
288
|
+
* 0.7.1 — see `MsbCliBackend.bootRestoreOnce`'s own doc), so without EITHER
|
|
289
|
+
* source this library has no workload argv left to revive. Thrown instead of
|
|
290
|
+
* silently booting the sandbox idle — the checkpoint either predates
|
|
291
|
+
* workload-cmdline capture, or its capture attempt failed at checkpoint time
|
|
292
|
+
* (see `CheckpointRegistryEntry.capturedCommand`'s own doc on why a capture
|
|
293
|
+
* failure never fails the checkpoint that created it, only a later restore
|
|
294
|
+
* of it). Only ever thrown by the microsandbox backend.
|
|
295
|
+
*/
|
|
296
|
+
export declare class CheckpointWorkloadCommandMissingError extends Error {
|
|
297
|
+
/** The checkpoint ref being restored. */
|
|
298
|
+
readonly ref: string;
|
|
299
|
+
constructor(
|
|
300
|
+
/** The checkpoint ref being restored. */
|
|
301
|
+
ref: string);
|
|
302
|
+
}
|
|
254
303
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAEhD,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,qFAAqF;IACrF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;;IALxB,uDAAuD;IAC9C,OAAO,EAAE,MAAM;IACxB,yDAAyD;IAChD,OAAO,EAAE,MAAM;IACxB,qFAAqF;IAC5E,MAAM,CAAC,EAAE,MAAM,YAAA;CAK3B;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAG5C,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;gBAFxB,OAAO,EAAE,MAAM;IACf,4FAA4F;IACnF,KAAK,CAAC,EAAE,OAAO,YAAA;CAK3B;AAED,gFAAgF;AAChF,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED,8EAA8E;AAC9E,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAI5B;AAED,kIAAkI;AAClI,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;GASG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;;CAS/C;AAED;;;;;;GAMG;AACH,qBAAa,sBAAuB,SAAQ,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Q,CAAC,OAAO,EAAE,MAAM;IACxB,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,MAAM;;IAHzB,4CAA4C;IACnC,OAAO,EAAE,MAAM;IACxB,mDAAmD;IAC1C,QAAQ,EAAE,MAAM;CAQ5B;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;;CAQtD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;;CAQlD;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,qCAAsC,SAAQ,KAAK;IAE5D,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM;;IADpB,yCAAyC;IAChC,GAAG,EAAE,MAAM;CAUvB"}
|
package/dist/core/errors.js
CHANGED
|
@@ -158,6 +158,40 @@ export class ReuseFromCheckpointError extends Error {
|
|
|
158
158
|
this.name = "ReuseFromCheckpointError";
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Thrown at `start()` when a container built via `GenericContainer.fromCheckpoint()`
|
|
163
|
+
* carries an env that no longer matches the checkpoint's own captured env —
|
|
164
|
+
* an extra `withEnv()` call, or one overriding a key the checkpoint already
|
|
165
|
+
* set — and the active backend has no way to apply that at restore time.
|
|
166
|
+
*
|
|
167
|
+
* msb is the one backend this affects: 0.7.1 replaced `run --from-snapshot`
|
|
168
|
+
* with a dedicated `msb restore` command that has no `-e`/`--env` flag at
|
|
169
|
+
* all (a disk-only restore replays the sandbox's own captured
|
|
170
|
+
* configuration). Before 0.7.1, an overridden or extended env silently
|
|
171
|
+
* reached the restored guest via `run -e`; since there is now no msb
|
|
172
|
+
* invocation this library could emit that would honor it, silently dropping
|
|
173
|
+
* it would let the workload boot with env the caller never asked for and
|
|
174
|
+
* without env it did ask for — a correctness bug, not a graceful
|
|
175
|
+
* degradation — so this throws instead, before any backend call. Restoring
|
|
176
|
+
* with the checkpoint's own env completely unchanged never hits this: only
|
|
177
|
+
* a call that actually changes what would be sent does. docker is
|
|
178
|
+
* unaffected — restoring there is an ordinary `docker create`/`run` against
|
|
179
|
+
* the committed image with a fresh env array, so this is never thrown when
|
|
180
|
+
* the active backend is `"docker"`.
|
|
181
|
+
*/
|
|
182
|
+
export class CheckpointRestoreEnvOverrideError extends Error {
|
|
183
|
+
backend;
|
|
184
|
+
constructor(
|
|
185
|
+
/** The active backend's name — always `"microsandbox"` today, the one backend this affects. */
|
|
186
|
+
backend) {
|
|
187
|
+
super(`fromCheckpoint(...).withEnv(...) cannot override or extend a checkpoint's captured env when restoring ` +
|
|
188
|
+
`on the '${backend}' backend — its restore command has no way to inject env at boot time, so an ` +
|
|
189
|
+
`overridden or extended env would be silently dropped instead of reaching the restored workload. ` +
|
|
190
|
+
`Restore with the checkpoint's own env unchanged, or bake the desired env into a fresh checkpoint instead.`);
|
|
191
|
+
this.backend = backend;
|
|
192
|
+
this.name = "CheckpointRestoreEnvOverrideError";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
161
195
|
/**
|
|
162
196
|
* Thrown by `copyFileToContainer`/`copyContentToContainer`/
|
|
163
197
|
* `copyFileFromContainer` when `containerPath` is not absolute — both
|
|
@@ -326,4 +360,31 @@ export class TmpfsRootCheckpointError extends Error {
|
|
|
326
360
|
this.name = "TmpfsRootCheckpointError";
|
|
327
361
|
}
|
|
328
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Thrown restoring a microsandbox checkpoint whose source container had no
|
|
365
|
+
* explicit command (the image's own default entrypoint was running) and
|
|
366
|
+
* whose registry entry carries no captured workload cmdline either —
|
|
367
|
+
* `msb restore` boots a restored sandbox with only its guest agent inside
|
|
368
|
+
* and never re-runs anything on its own (EMPIRICALLY VERIFIED against msb
|
|
369
|
+
* 0.7.1 — see `MsbCliBackend.bootRestoreOnce`'s own doc), so without EITHER
|
|
370
|
+
* source this library has no workload argv left to revive. Thrown instead of
|
|
371
|
+
* silently booting the sandbox idle — the checkpoint either predates
|
|
372
|
+
* workload-cmdline capture, or its capture attempt failed at checkpoint time
|
|
373
|
+
* (see `CheckpointRegistryEntry.capturedCommand`'s own doc on why a capture
|
|
374
|
+
* failure never fails the checkpoint that created it, only a later restore
|
|
375
|
+
* of it). Only ever thrown by the microsandbox backend.
|
|
376
|
+
*/
|
|
377
|
+
export class CheckpointWorkloadCommandMissingError extends Error {
|
|
378
|
+
ref;
|
|
379
|
+
constructor(
|
|
380
|
+
/** The checkpoint ref being restored. */
|
|
381
|
+
ref) {
|
|
382
|
+
super(`sandbox restore from checkpoint '${ref}' has no explicit command and no captured workload cmdline in ` +
|
|
383
|
+
"its registry entry — this checkpoint predates workload-cmdline capture, or its capture attempt " +
|
|
384
|
+
"failed at checkpoint time, so there is no workload argv left to revive. Re-checkpoint the source " +
|
|
385
|
+
"container under a build that captures one.");
|
|
386
|
+
this.ref = ref;
|
|
387
|
+
this.name = "CheckpointWorkloadCommandMissingError";
|
|
388
|
+
}
|
|
389
|
+
}
|
|
329
390
|
//# sourceMappingURL=errors.js.map
|
package/dist/core/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAGvC;IAEA;IAEA;IANX;IACE,uDAAuD;IAC9C,OAAe;IACxB,yDAAyD;IAChD,OAAe;IACxB,qFAAqF;IAC5E,MAAe;QAExB,KAAK,CAAC,YAAY,OAAO,8BAA8B,OAAO,YAAY,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QANjG,YAAO,GAAP,OAAO,CAAQ;QAEf,YAAO,GAAP,OAAO,CAAQ;QAEf,WAAM,GAAN,MAAM,CAAS;QAGxB,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,qBAAsB,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,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,qCAAsC,SAAQ,KAAK;IAGnD;IAFX;IACE,yCAAyC;IAChC,GAAW;QAEpB,KAAK,CACH,oCAAoC,GAAG,gEAAgE;YACrG,iGAAiG;YACjG,mGAAmG;YACnG,4CAA4C,CAC/C,CAAC;QAPO,QAAG,GAAH,GAAG,CAAQ;QAQpB,IAAI,CAAC,IAAI,GAAG,uCAAuC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -10,14 +10,32 @@
|
|
|
10
10
|
export declare function allocate(): Promise<number>;
|
|
11
11
|
/** Releases a port back to the pool. Releasing a port never issued by this process is a harmless no-op. */
|
|
12
12
|
export declare function release(port: number): void;
|
|
13
|
+
/**
|
|
14
|
+
* The UDP counterpart of `allocate`: same in-process-uniqueness contract,
|
|
15
|
+
* same retry shape, but proven free by binding a UDP socket (see
|
|
16
|
+
* `bindEphemeralUdpPort`) rather than a TCP listener — a TCP probe cannot
|
|
17
|
+
* stand in for this, since the two transports keep independent OS port
|
|
18
|
+
* tables.
|
|
19
|
+
*/
|
|
20
|
+
export declare function allocateUdp(): Promise<number>;
|
|
21
|
+
/** Releases a UDP port back to its pool — the UDP counterpart of `release`. Releasing a port never issued by this process is a harmless no-op. */
|
|
22
|
+
export declare function releaseUdp(port: number): void;
|
|
13
23
|
/** Test-only observability seam: the ports currently considered issued. */
|
|
14
24
|
export declare function issuedView(): ReadonlySet<number>;
|
|
25
|
+
/** Test-only observability seam for the UDP pool — see `issuedView`. */
|
|
26
|
+
export declare function issuedUdpView(): ReadonlySet<number>;
|
|
15
27
|
export declare const FreePorts: {
|
|
16
28
|
/** Allocates a host port this process has not already handed out — see `allocate` above. */
|
|
17
29
|
allocate: typeof allocate;
|
|
18
30
|
/** Releases a port back to the pool — see `release` above. */
|
|
19
31
|
release: typeof release;
|
|
32
|
+
/** Allocates a UDP host port this process has not already handed out — see `allocateUdp` above. */
|
|
33
|
+
allocateUdp: typeof allocateUdp;
|
|
34
|
+
/** Releases a UDP port back to its pool — see `releaseUdp` above. */
|
|
35
|
+
releaseUdp: typeof releaseUdp;
|
|
20
36
|
/** Test-only observability seam — see `issuedView` above. */
|
|
21
37
|
issuedView: typeof issuedView;
|
|
38
|
+
/** Test-only observability seam for the UDP pool — see `issuedUdpView` above. */
|
|
39
|
+
issuedUdpView: typeof issuedUdpView;
|
|
22
40
|
};
|
|
23
41
|
//# sourceMappingURL=free-ports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"free-ports.d.ts","sourceRoot":"","sources":["../../src/core/free-ports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"free-ports.d.ts","sourceRoot":"","sources":["../../src/core/free-ports.ts"],"names":[],"mappings":"AA+DA;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAShD;AAED,2GAA2G;AAC3G,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CASnD;AAED,kJAAkJ;AAClJ,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,IAAI,WAAW,CAAC,MAAM,CAAC,CAEhD;AAED,wEAAwE;AACxE,wBAAgB,aAAa,IAAI,WAAW,CAAC,MAAM,CAAC,CAEnD;AAED,eAAO,MAAM,SAAS;IACpB,4FAA4F;;IAE5F,8DAA8D;;IAE9D,mGAAmG;;IAEnG,qEAAqE;;IAErE,6DAA6D;;IAE7D,iFAAiF;;CAElF,CAAC"}
|
package/dist/core/free-ports.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as net from "node:net";
|
|
2
|
+
import * as dgram from "node:dgram";
|
|
2
3
|
const MAX_ALLOCATE_ATTEMPTS = 100;
|
|
3
4
|
// Binds are loopback-only (127.0.0.1), not wildcard — the same conservative
|
|
4
5
|
// choice used everywhere else a host port is touched (publishing, wait
|
|
@@ -24,7 +25,36 @@ function bindEphemeralPort() {
|
|
|
24
25
|
});
|
|
25
26
|
});
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The UDP counterpart of `bindEphemeralPort`: a TCP `listen()` proves
|
|
30
|
+
* nothing about UDP's independent OS port table (and vice versa) — a port
|
|
31
|
+
* free on one transport can easily be bound on the other — so a UDP host
|
|
32
|
+
* port must be proven free by binding an actual UDP socket, not inferred
|
|
33
|
+
* from the TCP probe. Same shape as the TCP path: bind ephemeral, read the
|
|
34
|
+
* assigned port back, close, hand the number to the caller.
|
|
35
|
+
*/
|
|
36
|
+
function bindEphemeralUdpPort() {
|
|
37
|
+
return new Promise((resolvePort, rejectPort) => {
|
|
38
|
+
const socket = dgram.createSocket("udp4");
|
|
39
|
+
socket.once("error", (err) => {
|
|
40
|
+
rejectPort(err);
|
|
41
|
+
});
|
|
42
|
+
socket.bind(0, BIND_HOST, () => {
|
|
43
|
+
const address = socket.address();
|
|
44
|
+
const port = address.port;
|
|
45
|
+
socket.close(() => {
|
|
46
|
+
resolvePort(port);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
27
51
|
const issued = new Set();
|
|
52
|
+
// A separate issued set for UDP: TCP and UDP each have their own OS-level
|
|
53
|
+
// port table, so the two pools track uniqueness independently — a port
|
|
54
|
+
// issued on one transport says nothing about the other, and a container may
|
|
55
|
+
// legitimately be handed the same numeric port on both (see `PortBinding`'s
|
|
56
|
+
// own doc on the DNS-53 case).
|
|
57
|
+
const issuedUdp = new Set();
|
|
28
58
|
/**
|
|
29
59
|
* Allocates a host port this process has not already handed out. Binding
|
|
30
60
|
* `127.0.0.1:0` and immediately closing the socket leaves a window where
|
|
@@ -48,16 +78,47 @@ export async function allocate() {
|
|
|
48
78
|
export function release(port) {
|
|
49
79
|
issued.delete(port);
|
|
50
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* The UDP counterpart of `allocate`: same in-process-uniqueness contract,
|
|
83
|
+
* same retry shape, but proven free by binding a UDP socket (see
|
|
84
|
+
* `bindEphemeralUdpPort`) rather than a TCP listener — a TCP probe cannot
|
|
85
|
+
* stand in for this, since the two transports keep independent OS port
|
|
86
|
+
* tables.
|
|
87
|
+
*/
|
|
88
|
+
export async function allocateUdp() {
|
|
89
|
+
for (let attempt = 0; attempt < MAX_ALLOCATE_ATTEMPTS; attempt++) {
|
|
90
|
+
const port = await bindEphemeralUdpPort();
|
|
91
|
+
if (!issuedUdp.has(port)) {
|
|
92
|
+
issuedUdp.add(port);
|
|
93
|
+
return port;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
throw new Error(`could not allocate a unique free UDP port after ${MAX_ALLOCATE_ATTEMPTS} attempts`);
|
|
97
|
+
}
|
|
98
|
+
/** Releases a UDP port back to its pool — the UDP counterpart of `release`. Releasing a port never issued by this process is a harmless no-op. */
|
|
99
|
+
export function releaseUdp(port) {
|
|
100
|
+
issuedUdp.delete(port);
|
|
101
|
+
}
|
|
51
102
|
/** Test-only observability seam: the ports currently considered issued. */
|
|
52
103
|
export function issuedView() {
|
|
53
104
|
return new Set(issued);
|
|
54
105
|
}
|
|
106
|
+
/** Test-only observability seam for the UDP pool — see `issuedView`. */
|
|
107
|
+
export function issuedUdpView() {
|
|
108
|
+
return new Set(issuedUdp);
|
|
109
|
+
}
|
|
55
110
|
export const FreePorts = {
|
|
56
111
|
/** Allocates a host port this process has not already handed out — see `allocate` above. */
|
|
57
112
|
allocate,
|
|
58
113
|
/** Releases a port back to the pool — see `release` above. */
|
|
59
114
|
release,
|
|
115
|
+
/** Allocates a UDP host port this process has not already handed out — see `allocateUdp` above. */
|
|
116
|
+
allocateUdp,
|
|
117
|
+
/** Releases a UDP port back to its pool — see `releaseUdp` above. */
|
|
118
|
+
releaseUdp,
|
|
60
119
|
/** Test-only observability seam — see `issuedView` above. */
|
|
61
120
|
issuedView,
|
|
121
|
+
/** Test-only observability seam for the UDP pool — see `issuedUdpView` above. */
|
|
122
|
+
issuedUdpView,
|
|
62
123
|
};
|
|
63
124
|
//# sourceMappingURL=free-ports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"free-ports.js","sourceRoot":"","sources":["../../src/core/free-ports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"free-ports.js","sourceRoot":"","sources":["../../src/core/free-ports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAEpC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,4EAA4E;AAC5E,uEAAuE;AACvE,2EAA2E;AAC3E,MAAM,SAAS,GAAG,WAAW,CAAC;AAE9B,SAAS,iBAAiB;IACxB,OAAO,IAAI,OAAO,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE;QAC7C,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YAC3B,UAAU,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;YAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YACjC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;gBACpD,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,UAAU,CAAC,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC,CAAC;gBAChF,OAAO;YACT,CAAC;YACD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CA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
|
|
@@ -26,6 +26,8 @@ export declare class GenericContainer implements AsyncDisposable, NetworkMember
|
|
|
26
26
|
private readonly image;
|
|
27
27
|
private envPairs;
|
|
28
28
|
private exposedPorts;
|
|
29
|
+
/** UDP counterpart of `exposedPorts` (`withExposedUdpPorts`) — a separate field, never merged with the TCP list; see `PortBinding`'s own doc on why the same guest port can appear in both. */
|
|
30
|
+
private exposedUdpPorts;
|
|
29
31
|
private command;
|
|
30
32
|
private network;
|
|
31
33
|
private aliasNames;
|
|
@@ -40,9 +42,20 @@ export declare class GenericContainer implements AsyncDisposable, NetworkMember
|
|
|
40
42
|
private requireIsolationRequested;
|
|
41
43
|
private checkpointRef;
|
|
42
44
|
private checkpointSourceBackend;
|
|
45
|
+
/**
|
|
46
|
+
* `cp.spec.env` exactly as captured, set once by `fromCheckpoint()` and
|
|
47
|
+
* never touched again — kept separate from the mutable `envPairs` so
|
|
48
|
+
* `start()` can tell "the caller re-applied the checkpoint's own env
|
|
49
|
+
* unchanged" from "the caller actually overrode or extended it" (see
|
|
50
|
+
* `CheckpointRestoreEnvOverrideError`). `undefined` for every container
|
|
51
|
+
* not built via `fromCheckpoint()`.
|
|
52
|
+
*/
|
|
53
|
+
private checkpointCapturedEnv;
|
|
43
54
|
private handle;
|
|
44
55
|
private backend;
|
|
45
56
|
private mappedPorts;
|
|
57
|
+
/** UDP counterpart of `mappedPorts` — a SEPARATE per-protocol store, never a shared bare-int-keyed map (see `getMappedUdpPort`). */
|
|
58
|
+
private mappedUdpPorts;
|
|
46
59
|
private running;
|
|
47
60
|
private installedNetworkLinks;
|
|
48
61
|
/** Builds against `image` (e.g. `"redis:8.6-alpine"`); no I/O happens until `start()`. */
|
|
@@ -61,15 +74,42 @@ export declare class GenericContainer implements AsyncDisposable, NetworkMember
|
|
|
61
74
|
* captures. `start()` throws `CheckpointBackendMismatchError` before any
|
|
62
75
|
* backend call if the active backend isn't the one that created `cp`, and
|
|
63
76
|
* `ReuseFromCheckpointError` if this container is also marked
|
|
64
|
-
* `withReuse()` — reuse's identity hash never covers a checkpoint ref.
|
|
77
|
+
* `withReuse()` — reuse's identity hash never covers a checkpoint ref. On
|
|
78
|
+
* msb specifically, `start()` also throws `CheckpointRestoreEnvOverrideError`
|
|
79
|
+
* before any backend call if a further `withEnv()` call actually changes
|
|
80
|
+
* the env beyond what `cp.spec.env` captured — msb's restore command has
|
|
81
|
+
* no way to inject env at boot time (see that error's own doc); re-calling
|
|
82
|
+
* `withEnv()` with the checkpoint's own captured values, unchanged, never
|
|
83
|
+
* throws. docker is unaffected — an overridden/extended env reaches a
|
|
84
|
+
* docker restore normally.
|
|
65
85
|
* Once started, a restored container is ordinary in every other respect:
|
|
66
86
|
* fresh host ports, normal reaping-ledger tracking, normal stop.
|
|
67
87
|
*/
|
|
68
88
|
static fromCheckpoint(cp: Checkpoint): GenericContainer;
|
|
69
89
|
/** Sets an environment variable visible to the workload. Last-write-wins if called again with the same key; insertion order is otherwise preserved. */
|
|
70
90
|
withEnv(key: string, value: string): this;
|
|
71
|
-
/** Publishes these guest ports to pre-allocated host ports (see `FreePorts`); read back with `getMappedPort`. */
|
|
91
|
+
/** Publishes these guest ports to pre-allocated host ports (see `FreePorts`); read back with `getMappedPort`. TCP only — see `withExposedUdpPorts` for UDP. */
|
|
72
92
|
withExposedPorts(...ports: number[]): this;
|
|
93
|
+
/**
|
|
94
|
+
* Publishes these guest ports over UDP to pre-allocated host ports (see
|
|
95
|
+
* `FreePorts.allocateUdp`); read back with `getMappedUdpPort`. A separate
|
|
96
|
+
* list from `withExposedPorts` — the same numeric guest port may be
|
|
97
|
+
* exposed on both protocols (DNS's 53, say), and each gets its own
|
|
98
|
+
* independent host-port mapping.
|
|
99
|
+
*
|
|
100
|
+
* UDP exposure is deliberately invisible to the default wait strategies:
|
|
101
|
+
* `Wait.forListeningPort()`/`Wait.forHttp()` only ever probe
|
|
102
|
+
* `withExposedPorts`' TCP guest ports, so a container exposing ONLY UDP
|
|
103
|
+
* ports is vacuously ready under the default wait — prefer
|
|
104
|
+
* `Wait.forLogMessage(...)` for a UDP-only service.
|
|
105
|
+
*
|
|
106
|
+
* A UDP-exposed container can be a link target on a `Network` on both
|
|
107
|
+
* backends. On microsandbox the consumer gets an in-guest forwarder per UDP
|
|
108
|
+
* link, which needs a busybox-style `nc` (with `-u`/`-e`) and `timeout` in
|
|
109
|
+
* the consumer image; a datagram over 1472 bytes of payload breaks the
|
|
110
|
+
* receiving sandbox's inbound networking there (see the networking guide).
|
|
111
|
+
*/
|
|
112
|
+
withExposedUdpPorts(...ports: number[]): this;
|
|
73
113
|
/** Overrides the image's default ENTRYPOINT/CMD. Omit this call entirely to run the image unmodified. */
|
|
74
114
|
withCommand(...cmd: string[]): this;
|
|
75
115
|
/** Joins a `Network`, making this container reachable from (and to) its running siblings by alias. */
|
|
@@ -162,6 +202,7 @@ export declare class GenericContainer implements AsyncDisposable, NetworkMember
|
|
|
162
202
|
*/
|
|
163
203
|
protected currentBackend(): SandboxBackend;
|
|
164
204
|
private resolveBackend;
|
|
205
|
+
/** `hostUdpEgressPorts` is precomputed by `start()` from the SAME `linksForNewMember()` call `installNetworkLinks` is later given — never recomputed here, so the argv a networked boot builds from and the links actually installed after it always agree. */
|
|
165
206
|
private buildSpec;
|
|
166
207
|
/** The reuse-active counterpart of `buildSpec`: always `keepAlive: true`, named `rz-reuse-<hash12>` rather than the run-scoped `rz-<runId>-<seq>`, and never joined to a `Network` (rejected earlier in `start()`). */
|
|
167
208
|
private buildReuseSpec;
|
|
@@ -177,6 +218,8 @@ export declare class GenericContainer implements AsyncDisposable, NetworkMember
|
|
|
177
218
|
private computeReuseHash;
|
|
178
219
|
private allocatePorts;
|
|
179
220
|
private releasePorts;
|
|
221
|
+
/** Builds the `ContainerSpec.ports` array from this builder's TCP and UDP exposed-port lists plus their allocated host ports — shared by `buildSpec` and `buildReuseSpec`. */
|
|
222
|
+
private buildPortBindings;
|
|
180
223
|
/**
|
|
181
224
|
* Fails fast — before any backend call — on the combinations
|
|
182
225
|
* `withDiskLimit`, `withTmpfsRoot`, and `withNetworkDisabled` make
|
|
@@ -269,8 +312,10 @@ export declare class GenericContainer implements AsyncDisposable, NetworkMember
|
|
|
269
312
|
get host(): string;
|
|
270
313
|
/** Names this container answers to on its network (set via `withNetworkAliases`). Part of the `NetworkMember` contract `Network` uses to compute links. */
|
|
271
314
|
get aliases(): ReadonlyArray<string>;
|
|
272
|
-
/** Every guest port this container published (set via `withExposedPorts`). Part of the `NetworkMember` contract `Network` uses to compute links. */
|
|
315
|
+
/** Every guest port this container published over TCP (set via `withExposedPorts`). Part of the `NetworkMember` contract `Network` uses to compute links; also what the default wait strategies probe — see `withExposedUdpPorts`' own doc on why UDP ports never appear here. */
|
|
273
316
|
get exposedGuestPorts(): ReadonlyArray<number>;
|
|
317
|
+
/** Every guest port this container published over UDP (set via `withExposedUdpPorts`) — a separate list from `exposedGuestPorts`, never merged with it. Part of the `NetworkMember` contract `Network` uses to compute links. */
|
|
318
|
+
get exposedUdpGuestPorts(): ReadonlyArray<number>;
|
|
274
319
|
/**
|
|
275
320
|
* The host port bound to `guestPort`. Throws distinct messages for the
|
|
276
321
|
* two ways this can be wrong: not running at all ("call start() first"),
|
|
@@ -280,6 +325,18 @@ export declare class GenericContainer implements AsyncDisposable, NetworkMember
|
|
|
280
325
|
getMappedPort(guestPort: number): number;
|
|
281
326
|
/** Alias for `getMappedPort`, satisfying the `NetworkMember`/`WaitTarget` shape (which name this method `mappedPort`). */
|
|
282
327
|
mappedPort(guestPort: number): number;
|
|
328
|
+
/**
|
|
329
|
+
* The UDP counterpart of `getMappedPort` — reads from a SEPARATE
|
|
330
|
+
* per-protocol mapping store (`withExposedUdpPorts`), so exposing the same
|
|
331
|
+
* numeric guest port on both protocols (DNS's 53, say) never collides:
|
|
332
|
+
* `getMappedPort(53)` and `getMappedUdpPort(53)` can return two entirely
|
|
333
|
+
* different host ports. Throws the same two distinct-message shape as
|
|
334
|
+
* `getMappedPort`: not running at all, versus running but never exposed
|
|
335
|
+
* via `withExposedUdpPorts`.
|
|
336
|
+
*/
|
|
337
|
+
getMappedUdpPort(guestPort: number): number;
|
|
338
|
+
/** Alias for `getMappedUdpPort`, satisfying the `NetworkMember` shape (which names this method `mappedUdpPort`). */
|
|
339
|
+
mappedUdpPort(guestPort: number): number;
|
|
283
340
|
private requireHandle;
|
|
284
341
|
/**
|
|
285
342
|
* Captures this running container's state and returns a `Checkpoint` — a
|
|
@@ -292,21 +349,48 @@ export declare class GenericContainer implements AsyncDisposable, NetworkMember
|
|
|
292
349
|
* state error (same shape as `exec`/`logs`) if this container isn't
|
|
293
350
|
* currently running.
|
|
294
351
|
*
|
|
295
|
-
* Passing `name` makes this checkpoint NAMED and durable: the ref
|
|
296
|
-
* deterministic (
|
|
297
|
-
* on microsandbox, `rightsize/checkpoint:<name>` on docker — see
|
|
352
|
+
* Passing `name` makes this checkpoint NAMED and durable: on docker the ref
|
|
353
|
+
* becomes deterministic (`rightsize/checkpoint:<name>` — see
|
|
298
354
|
* `checkpointRef` — instead of a random 12-hex suffix), and — only once
|
|
299
355
|
* the backend call below has actually succeeded — a registry entry is written under
|
|
300
356
|
* `<cacheDir>/checkpoints/<name>.json` that `Checkpoints.find`/`list`/
|
|
301
357
|
* `remove` can rediscover later, in this process or a different one. `name`
|
|
302
358
|
* must match `^[a-z0-9][a-z0-9-]{0,40}$`; an invalid name throws
|
|
303
359
|
* `InvalidCheckpointNameError` before any backend call. Checkpointing under
|
|
304
|
-
* a name that already has a registry entry REPLACES it:
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
360
|
+
* a name that already has a registry entry REPLACES it: this best-effort
|
|
361
|
+
* clears whatever artifact the PRIOR checkpoint under `name` actually left
|
|
362
|
+
* behind, then overwrites the registry entry with the BACKEND'S OWN
|
|
363
|
+
* EFFECTIVE ref for the fresh checkpoint — the latest checkpoint under a
|
|
364
|
+
* name always wins. The prior artifact's real location comes from the
|
|
365
|
+
* existing registry entry itself (when one exists for a backend matching
|
|
366
|
+
* the currently active one) rather than a recomputed nominal ref: on
|
|
367
|
+
* docker the two are always the same deterministic value anyway, but on
|
|
368
|
+
* microsandbox (since 0.7.1) the effective ref is a content-addressed
|
|
369
|
+
* artifact path the nominal one never predicts (see
|
|
370
|
+
* `SandboxBackend.createCheckpoint`'s own doc), so reading it back from the
|
|
371
|
+
* registry is what makes this reliable there too — the same lookup
|
|
372
|
+
* `Checkpoints.remove(name)` itself uses.
|
|
373
|
+
*
|
|
374
|
+
* The PRIOR entry's real ref is only ever removed once the fresh
|
|
375
|
+
* checkpoint below has actually been created successfully (and, on a
|
|
376
|
+
* backend whose checkpoint reboots the workload, once the post-checkpoint
|
|
377
|
+
* re-wait below has succeeded too) — never before. When the prior ref and
|
|
378
|
+
* the freshly-minted nominal one are the SAME deterministic value (always
|
|
379
|
+
* true on docker), removing it earlier would just be removing the nominal
|
|
380
|
+
* ref that `createCheckpoint` is about to reuse anyway, so this method
|
|
381
|
+
* best-effort clears the nominal ref up front instead (a harmless no-op on
|
|
382
|
+
* microsandbox, where a name never predicts a real artifact); when the two
|
|
383
|
+
* differ (microsandbox's content-addressed case, or the rare coincidence
|
|
384
|
+
* of the two colliding on any backend), the prior ref is left completely
|
|
385
|
+
* untouched until the new one is confirmed both real and reachable. That
|
|
386
|
+
* ordering is what keeps a FAILED same-name re-checkpoint from destroying
|
|
387
|
+
* an otherwise-good, previously-restorable checkpoint: on any backend, a
|
|
388
|
+
* `createCheckpoint()` (or post-checkpoint re-wait) that throws leaves both
|
|
389
|
+
* the prior artifact and its registry entry completely untouched, exactly
|
|
390
|
+
* as if the failed call had never been attempted. Omitting `name` keeps
|
|
391
|
+
* the original behavior byte-for-byte: an ephemeral checkpoint with no
|
|
392
|
+
* registry entry, whose `Checkpoint.ref` is always the backend's own
|
|
393
|
+
* effective ref.
|
|
310
394
|
*
|
|
311
395
|
* On a backend whose `capabilities.checkpointRestartsWorkload` is `true`
|
|
312
396
|
* (microsandbox: the stop/snapshot/reboot cycle boots a fresh microVM),
|
|
@@ -323,6 +407,11 @@ export declare class GenericContainer implements AsyncDisposable, NetworkMember
|
|
|
323
407
|
* BEFORE the wait-strategy re-run — the wait must gate a container that is
|
|
324
408
|
* fully re-linked, not just booted.
|
|
325
409
|
*
|
|
410
|
+
* If that re-wait (or the link re-install before it) fails, this container
|
|
411
|
+
* is torn down to completion via `stop()` — same as a failed `start()` —
|
|
412
|
+
* before the rejection propagates, so a revived-but-never-ready workload
|
|
413
|
+
* never sits around as an orphan.
|
|
414
|
+
*
|
|
326
415
|
* Checkpoints are never auto-reaped (a committed image or a disk snapshot
|
|
327
416
|
* is not a container) — see the checkpoints guide for the manual cleanup
|
|
328
417
|
* one-liners and the `Checkpoints.remove` cleanup affordance.
|