euv_cli/update_server/struct.rs
1use super::*;
2
3/// Configuration for the read-only Hyperlane HTTP + SSE update server (never holds signing keys).
4#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
5pub struct UpdateServerConfig {
6 /// Local filesystem store root containing `staging/`, `blobs/`, `releases/`, `channels/`, and `state/`.
7 pub(crate) store_root: PathBuf,
8 /// Bind host address (default `127.0.0.1`).
9 pub(crate) host: String,
10 /// Bind TCP port (`0` selects an ephemeral port).
11 #[get(type(copy))]
12 pub(crate) port: u16,
13 /// Optional external reverse-proxy base URL (e.g. `https://ota.example.com/euv`).
14 #[serde(default)]
15 pub(crate) proxy_base: String,
16 /// SSE keep-alive heartbeat interval in milliseconds.
17 #[get(type(copy))]
18 pub(crate) heartbeat_ms: u64,
19 /// SSE client reconnect retry hint in milliseconds.
20 #[get(type(copy))]
21 pub(crate) retry_ms: u64,
22 /// Bounded per-topic SSE `Last-Event-ID` replay buffer size.
23 #[get(type(copy))]
24 pub(crate) replay_capacity: usize,
25 /// Filesystem pointer watcher polling interval in milliseconds.
26 #[get(type(copy))]
27 pub(crate) watch_poll_ms: u64,
28 /// Maximum allowed artifact byte size enforced during staging and publishing.
29 #[get(type(copy))]
30 pub(crate) max_artifact_bytes: u64,
31 /// When `true`, initializes the store, validates bind readiness, and exits immediately.
32 #[get(type(copy))]
33 pub(crate) once: bool,
34}
35
36/// Atomically swapped active release pointer persisted in `channels/<project>/<channel>/active.json`.
37#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
38pub struct ChannelPointer {
39 /// Logical project identifier.
40 pub(crate) project: String,
41 /// Release channel name.
42 pub(crate) channel: String,
43 /// Compatibility track label.
44 pub(crate) track: String,
45 /// Strictly monotonic active release sequence number.
46 #[get(type(copy))]
47 pub(crate) active_release_seq: u64,
48 /// SHA-256 hex digest of the active signed `ReleaseManifest`.
49 pub(crate) manifest_sha256: String,
50 /// UNIX epoch timestamp in seconds of the atomic pointer swap.
51 #[get(type(copy))]
52 pub(crate) updated_at_unix: u64,
53}
54
55/// Persisted bounded event record written to `state/events/<project>/<channel>.jsonl`.
56#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
57pub struct StoredReleaseEvent {
58 /// Monotonic event identifier matching `event.to_release`.
59 #[get(type(copy))]
60 pub(crate) event_id: u64,
61 /// Minimal `release.activated` metadata frame.
62 pub(crate) event: ReleaseActivatedEvent,
63}
64
65/// Local filesystem update store managing `staging/`, `blobs/sha256/`, `releases/`, `channels/`, and `state/`.
66#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
67pub struct UpdateStore {
68 /// Root filesystem directory of the update store.
69 pub(crate) root: PathBuf,
70 /// Maximum allowed byte size for any single artifact (`0` disables cap).
71 #[new(skip)]
72 #[get(type(copy))]
73 pub(crate) max_artifact_bytes: u64,
74}
75
76/// RAII writer lock guard owning `state/writer.lock` across multi-process CLI publish/rollback operations.
77#[derive(Debug)]
78pub(crate) struct UpdateWriterLockGuard {
79 /// Lockfile path removed automatically on drop.
80 pub(crate) lock_path: PathBuf,
81}
82
83/// Summary report emitted by `euv update stage`.
84#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
85pub struct StageReport {
86 /// Stage identifier inside `staging/`.
87 pub(crate) stage_id: String,
88 /// Logical project identifier.
89 pub(crate) project: String,
90 /// Target release channel.
91 pub(crate) channel: String,
92 /// Number of verified blobs staged.
93 #[get(type(copy))]
94 pub(crate) blob_count: usize,
95 /// Total verified staged bytes.
96 #[get(type(copy))]
97 pub(crate) total_bytes: u64,
98}
99
100/// Summary report emitted by `euv update publish` and `euv update rollback`.
101#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
102pub struct PublishReport {
103 /// Logical project identifier.
104 pub(crate) project: String,
105 /// Release channel name.
106 pub(crate) channel: String,
107 /// Compatibility track name.
108 pub(crate) track: String,
109 /// Previous active release sequence (`0` if initial release).
110 #[get(type(copy))]
111 pub(crate) from_release: u64,
112 /// Newly activated strictly monotonic release sequence.
113 #[get(type(copy))]
114 pub(crate) to_release: u64,
115 /// Optional historical release sequence targeted when this publish is a rollback.
116 #[new(skip)]
117 #[get(skip)]
118 pub(crate) rollback_of: Option<u64>,
119 /// SHA-256 hex digest of the sealed signed manifest.
120 pub(crate) manifest_sha256: String,
121 /// Routes whose pinned dependency graphs changed.
122 #[new(skip)]
123 pub(crate) affected_routes: Vec<String>,
124 /// Number of new blobs written into `blobs/sha256/`.
125 #[new(skip)]
126 #[get(type(copy))]
127 pub(crate) blobs_written: usize,
128}
129
130/// Status summary for a single project/channel inside `UpdateStoreStatus`.
131#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
132pub struct ChannelStatusEntry {
133 /// Logical project identifier.
134 pub(crate) project: String,
135 /// Channel name.
136 pub(crate) channel: String,
137 /// Current active channel pointer.
138 pub(crate) pointer: ChannelPointer,
139 /// Number of immutable release manifests stored under this channel.
140 #[get(type(copy))]
141 pub(crate) release_count: usize,
142 /// Number of retained event log records under `state/events/`.
143 #[get(type(copy))]
144 pub(crate) event_count: usize,
145}
146
147/// Complete status snapshot emitted by `euv update status`.
148#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
149pub struct UpdateStoreStatus {
150 /// Store root path string.
151 pub(crate) store_root: String,
152 /// Total immutable blobs currently stored in `blobs/sha256/`.
153 #[get(type(copy))]
154 pub(crate) blob_count: usize,
155 /// Total disk bytes occupied by immutable blobs.
156 #[get(type(copy))]
157 pub(crate) blob_total_bytes: u64,
158 /// Active channel summaries.
159 pub(crate) channels: Vec<ChannelStatusEntry>,
160}
161
162/// Machine-readable report emitted by `euv update serve`.
163#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
164pub struct UpdateServerReport {
165 /// Store root directory served.
166 pub(crate) store_root: String,
167 /// Bound HTTP base URL (e.g. `http://127.0.0.1:8787`).
168 pub(crate) url: String,
169 /// Manifest endpoint route template.
170 pub(crate) manifest_route: String,
171 /// Blob endpoint route template.
172 pub(crate) blob_route: String,
173 /// SSE events endpoint route template.
174 pub(crate) events_route: String,
175 /// Whether the server exited immediately after readiness validation (`--once`).
176 #[get(type(copy))]
177 pub(crate) once: bool,
178}
179
180/// Shared state mounted into Hyperlane routes for read-only manifest, blob, and SSE delivery.
181#[cfg(feature = "update-server")]
182#[derive(Clone)]
183pub struct UpdateServerState {
184 /// Backing atomic local filesystem update store.
185 pub(crate) store: UpdateStore,
186 /// Shared Hyperlane SSE pub/sub hub with bounded `Last-Event-ID` replay.
187 pub(crate) sse_hub: SseHub,
188 /// SSE stream heartbeat and reconnect configuration.
189 pub(crate) sse_config: SseConfig,
190 /// Optional configured reverse-proxy base URL advertised to clients.
191 pub(crate) proxy_base: String,
192 /// Last release sequence dispatched per `(project, channel)` to ensure exactly-once SSE fan-out per sequence.
193 pub(crate) dispatched_seqs: Arc<Mutex<HashMap<(String, String), u64>>>,
194 /// Cooperative running flag shared with the background pointer watcher.
195 pub(crate) running: Arc<AtomicBool>,
196}
197
198/// Running handle to a live Hyperlane HTTP + SSE update server with clean programmatic shutdown.
199#[cfg(feature = "update-server")]
200pub struct UpdateServerHandle {
201 /// Bound socket address (`ip:port`).
202 pub(crate) address: SocketAddr,
203 /// Shared update server state (store + SSE hub).
204 pub(crate) state: Arc<UpdateServerState>,
205 /// Hyperlane shutdown control hook.
206 pub(crate) control: Option<ServerControlHook>,
207 /// Dedicated Tokio runtime hosting the Hyperlane server and pointer watcher.
208 pub(crate) runtime: Option<runtime::Runtime>,
209}
210
211/// Hyperlane `ServerHook` serving `GET /v1/projects/{project}/channels/{channel}/manifest`.
212#[cfg(feature = "update-server")]
213pub struct ManifestRouteHook;
214
215/// Hyperlane `ServerHook` serving `GET /v1/blobs/{sha256}` with Range resume support.
216#[cfg(feature = "update-server")]
217pub struct BlobRouteHook;
218
219/// Hyperlane `ServerHook` streaming `GET /v1/projects/{project}/channels/{channel}/events` via `hyperlane-plugin-sse`.
220#[cfg(feature = "update-server")]
221pub struct EventsRouteHook;
222
223/// Hyperlane `ServerHook` serving `GET /healthz` JSON health and update store diagnostics.
224#[cfg(feature = "update-server")]
225pub struct HealthRouteHook;
226
227/// JSON health and store status payload emitted by `GET /healthz`.
228#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
229pub struct UpdateHealthResponse {
230 /// Health status indicator (`"ok"`).
231 pub(crate) status: String,
232 /// Backing update store root directory path.
233 pub(crate) store_root: String,
234 /// Total content-addressed blobs currently stored in `blobs/sha256/`.
235 #[get(type(copy))]
236 pub(crate) blob_count: usize,
237 /// Total disk bytes occupied by immutable blobs.
238 #[get(type(copy))]
239 pub(crate) blob_total_bytes: u64,
240 /// Total active project/channel pointers discovered.
241 #[get(type(copy))]
242 pub(crate) channel_count: usize,
243 /// Active channel status entries.
244 pub(crate) channels: Vec<ChannelStatusEntry>,
245 /// Whether the update server background watcher is running.
246 #[get(type(copy))]
247 pub(crate) running: bool,
248 /// Current UNIX epoch timestamp in seconds.
249 #[get(type(copy))]
250 pub(crate) timestamp_unix: u64,
251}
252
253/// Generated HMAC-SHA256 signing secret summary emitted by `euv update keygen`.
254#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
255pub struct KeygenReport {
256 /// 64-character lowercase hexadecimal 256-bit signing secret.
257 pub(crate) signing_key: String,
258 /// Target environment variable name (`EUV_UPDATE_SIGNING_KEY`).
259 pub(crate) env_var: String,
260 /// Ready-to-run shell export snippet.
261 pub(crate) export_hint: String,
262 /// Entropy bit length of the generated secret (`256`).
263 #[get(type(copy))]
264 pub(crate) bit_length: usize,
265}
266
267/// Persisted project OTA configuration written to `euv-ota.json` (never stores raw signing secrets).
268#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
269pub struct OtaProjectConfig {
270 /// Configuration schema version (`1`).
271 #[get(type(copy))]
272 pub(crate) schema_version: u32,
273 /// Logical project identifier.
274 pub(crate) project: String,
275 /// Default release channel name.
276 pub(crate) channel: String,
277 /// Relative or absolute local update store root path.
278 pub(crate) store_root: String,
279 /// Default update server HTTP base URL.
280 pub(crate) server_url: String,
281 /// Environment variable name holding the offline signing secret.
282 pub(crate) signing_key_env: String,
283}
284
285/// Configuration for initializing an update store and optional `euv-ota.json` project config.
286#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
287pub struct OtaInitConfig {
288 /// Local update store root directory (default `.euv-updates`).
289 pub(crate) store_root: PathBuf,
290 /// Logical project identifier.
291 pub(crate) project: String,
292 /// Default release channel name.
293 pub(crate) channel: String,
294 /// Optional path where `euv-ota.json` should be written.
295 pub(crate) config_path: Option<PathBuf>,
296 /// Optional explicit signing secret (auto-generated when `None`).
297 pub(crate) signing_key: Option<String>,
298 /// Default update server URL written into `euv-ota.json`.
299 pub(crate) server_url: String,
300}
301
302/// Summary report emitted by `euv update init`.
303#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
304pub struct OtaInitReport {
305 /// Initialized update store root directory path.
306 pub(crate) store_root: String,
307 /// Logical project identifier.
308 pub(crate) project: String,
309 /// Default release channel name.
310 pub(crate) channel: String,
311 /// Path to generated `euv-ota.json`, or empty when omitted.
312 pub(crate) config_file: String,
313 /// Generated or provided 256-bit HMAC-SHA256 signing secret.
314 pub(crate) signing_key: String,
315 /// Environment variable name for the signing secret.
316 pub(crate) signing_key_env: String,
317 /// Subdirectories created or ensured under `store_root`.
318 pub(crate) created_dirs: Vec<String>,
319}
320
321/// Sandbox and ABI verification summary for a dynamic `.wasm` widget binary.
322#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
323pub struct DynamicWasmValidation {
324 /// Verified `euv_abi_version` return value.
325 #[get(type(copy))]
326 pub(crate) abi_version: u32,
327 /// Sorted list of exported WASM function/memory names.
328 pub(crate) exports: Vec<String>,
329 /// Lowercase SHA-256 hex digest of the `.wasm` bytes.
330 pub(crate) sha256: String,
331 /// Byte length of the verified `.wasm` binary.
332 #[get(type(copy))]
333 pub(crate) size_bytes: u64,
334}
335
336/// Configuration for compiling, validating, and optionally pushing a Rust dynamic WASM widget crate.
337#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
338pub struct OtaBuildConfig {
339 /// Crate or workspace root directory containing `Cargo.toml`.
340 pub(crate) manifest_dir: PathBuf,
341 /// Optional Cargo package name to build (`--package`).
342 pub(crate) package: Option<String>,
343 /// Optional output file path for the validated `.wasm` artifact.
344 pub(crate) out_path: Option<PathBuf>,
345 /// Whether to compile with `--release` optimization profile.
346 #[get(type(copy))]
347 pub(crate) release: bool,
348 /// Whether to immediately sign and publish the built `.wasm` into `store_root`.
349 #[get(type(copy))]
350 pub(crate) push: bool,
351 /// Local update store root directory used when `push` is enabled.
352 pub(crate) store_root: PathBuf,
353 /// Logical project identifier used when `push` is enabled.
354 pub(crate) project: String,
355 /// Release channel name used when `push` is enabled.
356 pub(crate) channel: String,
357 /// Optional target route path updated when `push` is enabled.
358 pub(crate) route: Option<String>,
359 /// Optional target component slot identifier updated when `push` is enabled.
360 pub(crate) slot: Option<String>,
361 /// Optional signing secret used when `push` is enabled.
362 pub(crate) signing_key: Option<String>,
363}
364
365/// Summary report emitted by `euv update build`.
366#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
367pub struct OtaBuildReport {
368 /// Output filesystem path of the verified `.wasm` widget artifact.
369 pub(crate) wasm_path: String,
370 /// SHA-256 hex digest of the compiled `.wasm` binary.
371 pub(crate) sha256: String,
372 /// Byte length of the compiled `.wasm` binary.
373 #[get(type(copy))]
374 pub(crate) size_bytes: u64,
375 /// Verified host ABI version reported by `euv_abi_version`.
376 #[get(type(copy))]
377 pub(crate) abi_version: u32,
378 /// Sorted list of WASM module exports.
379 pub(crate) exports: Vec<String>,
380 /// Optional publish report when `--push` was enabled.
381 #[new(skip)]
382 pub(crate) pushed: Option<PublishReport>,
383}
384
385/// Configuration for the unified single-command `euv update dev` serve-and-watch loop.
386#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
387pub struct OtaDevConfig {
388 /// Local update store root directory.
389 pub(crate) store_root: PathBuf,
390 /// Host bind address (`127.0.0.1` or `0.0.0.0`).
391 pub(crate) host: String,
392 /// TCP listen port (`0` selects an ephemeral port).
393 #[get(type(copy))]
394 pub(crate) port: u16,
395 /// Optional external reverse-proxy base URL.
396 pub(crate) proxy_base: String,
397 /// Logical project identifier.
398 pub(crate) project: String,
399 /// Release channel name (default `"dev"`).
400 pub(crate) channel: String,
401 /// Optional target route path for watched artifacts.
402 pub(crate) route: Option<String>,
403 /// Optional target component slot identifier for watched artifacts.
404 pub(crate) slot: Option<String>,
405 /// Optional watched `.json`, `.wasm`, or Rust widget crate directory path.
406 pub(crate) watch_path: Option<PathBuf>,
407 /// Optional Cargo package name when watching a Rust dynamic widget crate.
408 pub(crate) package: Option<String>,
409 /// Signing secret used for live pushes (auto-generated when empty).
410 pub(crate) signing_key: String,
411 /// SSE keep-alive heartbeat interval in milliseconds.
412 #[get(type(copy))]
413 pub(crate) heartbeat_ms: u64,
414 /// Watcher poll interval in milliseconds.
415 #[get(type(copy))]
416 pub(crate) poll_ms: u64,
417 /// When `true`, performs initial startup/push readiness verification and exits immediately.
418 #[get(type(copy))]
419 pub(crate) once: bool,
420}
421
422/// Machine-readable report emitted by `euv update dev`.
423#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
424pub struct OtaDevReport {
425 /// Backing update store root directory.
426 pub(crate) store_root: String,
427 /// Bound localhost HTTP URL.
428 pub(crate) local_url: String,
429 /// Detected LAN HTTP manifest URLs reachable from mobile devices and emulators.
430 pub(crate) lan_urls: Vec<String>,
431 /// Full manifest URL for the configured project and channel.
432 pub(crate) manifest_url: String,
433 /// Full SSE events URL for the configured project and channel.
434 pub(crate) events_url: String,
435 /// Health endpoint URL (`/healthz`).
436 pub(crate) health_url: String,
437 /// Configured logical project identifier.
438 pub(crate) project: String,
439 /// Configured release channel name.
440 pub(crate) channel: String,
441 /// Optional initial release published from `watch_path`.
442 pub(crate) initial_release: Option<PublishReport>,
443 /// Whether `--once` smoke mode exited immediately.
444 #[get(type(copy))]
445 pub(crate) once: bool,
446}
447
448/// Configuration controlling offline cryptographic and blob integrity verification (`euv update verify`).
449#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
450pub struct OtaVerifyConfig {
451 /// Local update store root directory to audit.
452 pub(crate) store_root: PathBuf,
453 /// Optional project filter.
454 pub(crate) project: Option<String>,
455 /// Optional channel filter.
456 pub(crate) channel: Option<String>,
457 /// Optional HMAC-SHA256 signing secret enabling full cryptographic signature verification.
458 pub(crate) signing_key: Option<String>,
459 /// When `true`, audits every historical release manifest in addition to active pointers.
460 #[get(type(copy))]
461 pub(crate) all_releases: bool,
462 /// Optional explicit release sequence number to audit instead of active/all releases.
463 #[get(type(copy))]
464 #[serde(default)]
465 pub(crate) release_seq: Option<u64>,
466}
467
468/// Individual integrity finding recorded during `euv update verify`.
469#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
470pub struct OtaVerifyIssue {
471 /// Severity level (`"error"` or `"warning"`).
472 pub(crate) severity: String,
473 /// Affected channel, release sequence, or blob identifier.
474 pub(crate) scope: String,
475 /// Human-readable diagnostic description.
476 pub(crate) message: String,
477}
478
479/// Complete offline integrity audit report emitted by `euv update verify`.
480#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
481pub struct OtaVerifyReport {
482 /// Audited update store root path.
483 pub(crate) store_root: String,
484 /// `true` when zero `"error"` issues were found.
485 #[get(type(copy))]
486 pub(crate) valid: bool,
487 /// Number of channel pointers audited.
488 #[get(type(copy))]
489 pub(crate) channels_checked: usize,
490 /// Number of release manifests audited.
491 #[get(type(copy))]
492 pub(crate) releases_checked: usize,
493 /// Number of manifests cryptographically verified via HMAC-SHA256.
494 #[get(type(copy))]
495 pub(crate) signatures_verified: usize,
496 /// Number of unique content-addressed blobs verified via SHA-256.
497 #[get(type(copy))]
498 pub(crate) blobs_verified: usize,
499 /// Recorded errors and warnings.
500 pub(crate) issues: Vec<OtaVerifyIssue>,
501}
502
503/// Per-artifact comparison entry inside `OtaReleaseDiff`.
504#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
505pub struct OtaArtifactDiff {
506 /// Canonical artifact key (`"module_id@version"`).
507 pub(crate) artifact_key: String,
508 /// Classification (`"added"`, `"removed"`, `"changed"`, or `"unchanged"`).
509 pub(crate) status: String,
510 /// SHA-256 digest in the base release, if present.
511 pub(crate) from_sha256: Option<String>,
512 /// SHA-256 digest in the target release, if present.
513 pub(crate) to_sha256: Option<String>,
514 /// Byte size in the base release (`0` if added).
515 #[get(type(copy))]
516 pub(crate) from_bytes: u64,
517 /// Byte size in the target release (`0` if removed).
518 #[get(type(copy))]
519 pub(crate) to_bytes: u64,
520 /// Signed byte size difference (`to_bytes - from_bytes`).
521 #[get(type(copy))]
522 pub(crate) size_delta_bytes: i64,
523}
524
525/// Structured comparison between two release sequences (`from_seq` -> `to_seq`) emitted by `euv update diff`.
526#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
527pub struct OtaReleaseDiff {
528 /// Logical project identifier.
529 pub(crate) project: String,
530 /// Release channel name.
531 pub(crate) channel: String,
532 /// Base release sequence number.
533 #[get(type(copy))]
534 pub(crate) from_seq: u64,
535 /// Target release sequence number.
536 #[get(type(copy))]
537 pub(crate) to_seq: u64,
538 /// Compatibility track label of `from_seq`.
539 pub(crate) from_track: String,
540 /// Compatibility track label of `to_seq`.
541 pub(crate) to_track: String,
542 /// Whether the compatibility track changed between releases.
543 #[get(type(copy))]
544 pub(crate) track_changed: bool,
545 /// Delivery channel mode label of `from_seq`.
546 pub(crate) from_delivery_mode: String,
547 /// Delivery channel mode label of `to_seq`.
548 pub(crate) to_delivery_mode: String,
549 /// SHA-256 digest of the base release manifest.
550 pub(crate) from_manifest_sha256: String,
551 /// SHA-256 digest of the target release manifest.
552 pub(crate) to_manifest_sha256: String,
553 /// Optional rollback origin recorded on `to_seq`.
554 #[get(type(copy))]
555 pub(crate) rollback_of: Option<u64>,
556 /// Routes whose transitive dependency graph changed.
557 pub(crate) affected_routes: Vec<String>,
558 /// Routes newly introduced in `to_seq`.
559 pub(crate) added_routes: Vec<String>,
560 /// Routes removed in `to_seq`.
561 pub(crate) removed_routes: Vec<String>,
562 /// Per-artifact SHA-256 and byte-size deltas.
563 pub(crate) artifact_diffs: Vec<OtaArtifactDiff>,
564 /// Total artifact bytes in `from_seq`.
565 #[get(type(copy))]
566 pub(crate) total_from_bytes: u64,
567 /// Total artifact bytes in `to_seq`.
568 #[get(type(copy))]
569 pub(crate) total_to_bytes: u64,
570 /// Signed total byte delta (`total_to_bytes - total_from_bytes`).
571 #[get(type(copy))]
572 pub(crate) total_size_delta_bytes: i64,
573}
574
575/// Configuration controlling safe update store garbage collection (`euv update gc`).
576#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
577pub struct OtaGcConfig {
578 /// Local update store root directory.
579 pub(crate) store_root: PathBuf,
580 /// Number of newest releases per channel to keep (active, track, and rollback targets are always preserved).
581 #[get(type(copy))]
582 pub(crate) keep_releases: usize,
583 /// When `true`, computes removals without deleting files on disk.
584 #[get(type(copy))]
585 pub(crate) dry_run: bool,
586 /// When `true`, removes stale directories under `staging/`.
587 #[get(type(copy))]
588 pub(crate) prune_staging: bool,
589}
590
591/// Summary report emitted by `euv update gc`.
592#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
593pub struct OtaGcReport {
594 /// Garbage-collected update store root path.
595 pub(crate) store_root: String,
596 /// Whether `--dry-run` prevented on-disk deletions.
597 #[get(type(copy))]
598 pub(crate) dry_run: bool,
599 /// Number of release manifests retained across all channels.
600 #[get(type(copy))]
601 pub(crate) releases_kept: usize,
602 /// Number of unreferenced old release manifests removed.
603 #[get(type(copy))]
604 pub(crate) releases_removed: usize,
605 /// Number of referenced content-addressed blobs retained.
606 #[get(type(copy))]
607 pub(crate) blobs_kept: usize,
608 /// Number of orphan blobs removed.
609 #[get(type(copy))]
610 pub(crate) blobs_removed: usize,
611 /// Number of stale staging directories removed.
612 #[get(type(copy))]
613 pub(crate) staging_dirs_removed: usize,
614 /// Total disk bytes reclaimed (or reclaimable in dry-run mode).
615 #[get(type(copy))]
616 pub(crate) bytes_reclaimed: u64,
617 /// Sorted list of removed (or candidate) filesystem paths.
618 pub(crate) removed_paths: Vec<String>,
619}
620
621/// Protocol-level HTTP response returned by the embeddable v1 OTA request handler mounted inside `euv dev`.
622#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
623pub struct EmbeddedOtaResponse {
624 /// Numeric HTTP status code (`200`, `204`, `206`, `304`, `400`, `404`, `405`, `409`, `416`).
625 #[get(type(copy))]
626 pub(crate) status_code: u16,
627 /// HTTP status reason phrase (`"OK"`, `"Not Modified"`, etc.).
628 #[get(type(copy))]
629 pub(crate) status_text: &'static str,
630 /// Response `Content-Type` header value.
631 #[get(type(copy))]
632 pub(crate) content_type: &'static str,
633 /// Additional HTTP response header `(name, value)` pairs.
634 pub(crate) headers: Vec<(String, String)>,
635 /// Raw HTTP response body bytes.
636 pub(crate) body: Vec<u8>,
637}