Skip to main content

arcbox_boot/
manifest.rs

1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4
5/// Schema version for the new multi-target manifest format.
6pub const SCHEMA_VERSION: u32 = 7;
7
8/// Top-level boot asset manifest (schema v7).
9///
10/// Supports multiple target architectures and host-side binaries.
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct Manifest {
13    pub schema_version: u32,
14    pub asset_version: String,
15    pub built_at: String,
16    #[serde(default, skip_serializing_if = "Option::is_none")]
17    pub source_repo: Option<String>,
18    #[serde(default, skip_serializing_if = "Option::is_none")]
19    pub source_ref: Option<String>,
20    #[serde(default, skip_serializing_if = "Option::is_none")]
21    pub source_sha: Option<String>,
22    /// Per-architecture boot targets (e.g. "arm64", "x86_64").
23    pub targets: BTreeMap<String, Target>,
24    /// Host-side binaries downloaded to ~/.arcbox/bin/.
25    #[serde(default, skip_serializing_if = "Vec::is_empty")]
26    pub binaries: Vec<Binary>,
27}
28
29/// Boot target for a single architecture.
30#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct Target {
32    pub kernel: FileEntry,
33    pub rootfs: FileEntry,
34    pub kernel_cmdline: String,
35}
36
37/// A file entry with path and checksum.
38#[derive(Debug, Clone, Serialize, Deserialize)]
39pub struct FileEntry {
40    pub path: String,
41    pub sha256: String,
42    #[serde(default, skip_serializing_if = "Option::is_none")]
43    pub version: Option<String>,
44}
45
46/// Host-side binary with per-architecture variants.
47#[derive(Debug, Clone, Serialize, Deserialize)]
48pub struct Binary {
49    pub name: String,
50    pub version: String,
51    /// Per-architecture file entries (e.g. "arm64" -> { path, sha256 }).
52    pub targets: BTreeMap<String, BinaryTarget>,
53}
54
55/// A single architecture variant of a binary.
56#[derive(Debug, Clone, Serialize, Deserialize)]
57pub struct BinaryTarget {
58    pub path: String,
59    pub sha256: String,
60}