Skip to main content

euv_core/dynamic/manifest/
struct.rs

1use super::*;
2
3/// Immutable content-addressed module or data artifact referenced by a `ReleaseManifest`.
4#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
5pub struct BlobArtifact {
6    /// Stable logical module identifier (e.g. `"page-a"`, `"card"`).
7    pub(crate) module_id: String,
8    /// Exact pinned implementation version string (e.g. `"1.0.0"`, `"2.0.0"`).
9    pub(crate) version: String,
10    /// Content-addressed lowercase SHA-256 hex digest.
11    pub(crate) sha256: String,
12    /// Exact artifact byte size.
13    #[get(type(copy))]
14    pub(crate) size_bytes: u64,
15    /// Artifact delivery classification (`WasmComponent`, `DeclarativeSpec`, or `AssetBundle`).
16    #[get(type(copy))]
17    pub(crate) kind: ArtifactKind,
18    /// Compile-time interface identifier satisfied by this artifact (e.g. `"euv:product-card/v1"`).
19    #[new(skip)]
20    #[serde(default)]
21    pub(crate) interface_id: String,
22    /// Interface major version number separate from implementation and state schema versions.
23    #[new(skip)]
24    #[serde(default)]
25    #[get(type(copy))]
26    pub(crate) interface_version: u32,
27    /// Local UI state schema version independent of interface and implementation versions.
28    #[new(skip)]
29    #[serde(default)]
30    #[get(type(copy))]
31    pub(crate) state_schema_version: u32,
32    /// Minimum compatible host ABI version.
33    #[new(skip)]
34    #[serde(default)]
35    #[get(type(copy))]
36    pub(crate) min_host_abi: u32,
37    /// Maximum compatible host ABI version.
38    #[new(skip)]
39    #[serde(default)]
40    #[get(type(copy))]
41    pub(crate) max_host_abi: u32,
42    /// Capabilities required by this module (e.g. `"storage.local"`, `"net.readonly"`).
43    #[new(skip)]
44    #[serde(default)]
45    pub(crate) required_capabilities: Vec<String>,
46    /// Logical entrypoint symbol or handler identifier.
47    #[new(skip)]
48    #[serde(default)]
49    pub(crate) entrypoint: String,
50    /// Direct pinned dependency artifact keys (`"module_id@version"`).
51    #[new(skip)]
52    #[serde(default)]
53    pub(crate) dependencies: Vec<String>,
54}
55
56/// Per-route pinned transitive dependency graph locking entry and logical slot bindings.
57#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
58pub struct RouteManifest {
59    /// Normalized route path (e.g. `"/route-a"`).
60    pub(crate) route: String,
61    /// Pinned entry artifact key (`"page-a@1.0.0"`).
62    pub(crate) entry_module: String,
63    /// Logical slot key to exact pinned artifact key map (`"card"` -> `"card@2.0.0"`).
64    #[new(skip)]
65    #[serde(default)]
66    pub(crate) slot_bindings: BTreeMap<String, String>,
67    /// Complete set of SHA-256 blob hashes required by this route's transitive dependency graph.
68    #[new(skip)]
69    #[serde(default)]
70    pub(crate) transitive_hashes: BTreeSet<String>,
71}
72
73/// Complete signed release manifest locking every route's transitive dependency graph.
74#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
75pub struct ReleaseManifest {
76    /// Manifest protocol schema version.
77    #[get(type(copy))]
78    pub(crate) manifest_schema: u32,
79    /// Logical project identifier.
80    pub(crate) project: String,
81    /// Release channel name (e.g. `"prod"`, `"beta"`).
82    pub(crate) channel: String,
83    /// Compatibility track identifier selected during client/server negotiation.
84    pub(crate) track: String,
85    /// Strictly monotonic release sequence number (rollbacks always advance this number).
86    #[get(type(copy))]
87    pub(crate) release_seq: u64,
88    /// Optional prior release sequence targeted when this release is a monotonic rollback.
89    #[new(skip)]
90    #[serde(default)]
91    #[get(skip)]
92    pub(crate) rollback_of: Option<u64>,
93    /// Delivery channel policy governing allowed artifacts (`WasmComponent` vs `DeclarativeData`).
94    #[get(type(copy))]
95    pub(crate) delivery_mode: DeliveryChannelMode,
96    /// Minimum host ABI version compatible with this release.
97    #[new(skip)]
98    #[get(type(copy))]
99    pub(crate) min_host_abi: u32,
100    /// Maximum host ABI version compatible with this release.
101    #[new(skip)]
102    #[get(type(copy))]
103    pub(crate) max_host_abi: u32,
104    /// Release-level required host capabilities.
105    #[new(skip)]
106    #[serde(default)]
107    pub(crate) required_capabilities: Vec<String>,
108    /// Map of pinned artifact keys (`"module_id@version"`) to artifact metadata.
109    #[new(skip)]
110    #[serde(default)]
111    pub(crate) artifacts: BTreeMap<String, BlobArtifact>,
112    /// Per-route pinned transitive dependency manifests.
113    #[new(skip)]
114    #[serde(default)]
115    pub(crate) routes: BTreeMap<String, RouteManifest>,
116    /// UNIX epoch timestamp in seconds when this release was sealed.
117    #[new(skip)]
118    #[serde(default)]
119    #[get(type(copy))]
120    pub(crate) created_at_unix: u64,
121    /// HMAC-SHA256 signature over canonical manifest JSON (computed with `signature` empty).
122    #[new(skip)]
123    #[serde(default)]
124    pub(crate) signature: String,
125}
126
127/// Minimal SSE notification frame pushed by the Hyperlane server upon pointer swap (zero code/bytes/paths).
128#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
129pub struct ReleaseActivatedEvent {
130    /// SSE event schema version.
131    #[get(type(copy))]
132    pub(crate) event_schema: u32,
133    /// Logical project identifier.
134    pub(crate) project: String,
135    /// Release channel name.
136    pub(crate) channel: String,
137    /// Compatibility track identifier.
138    pub(crate) track: String,
139    /// Previous active release sequence (`0` on initial release).
140    #[get(type(copy))]
141    pub(crate) from_release: u64,
142    /// Newly activated strictly monotonic release sequence.
143    #[get(type(copy))]
144    pub(crate) to_release: u64,
145    /// Non-authoritative hint listing routes whose pinned graphs changed.
146    #[new(skip)]
147    #[serde(default)]
148    pub(crate) affected_routes: Vec<String>,
149    /// SHA-256 digest of the canonical signed target manifest JSON.
150    pub(crate) manifest_sha256: String,
151}
152
153/// Client compatibility capabilities sent before subscription or manifest fetch.
154#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
155pub struct ClientNegotiation {
156    /// Supported dynamic update protocol version.
157    #[get(type(copy))]
158    pub(crate) protocol_version: u32,
159    /// Running host ABI version.
160    #[get(type(copy))]
161    pub(crate) host_abi: u32,
162    /// Allowed channel delivery mode (`WasmComponent` or `DeclarativeData`).
163    #[get(type(copy))]
164    pub(crate) delivery_mode: DeliveryChannelMode,
165    /// Capabilities exposed by this host build.
166    #[new(skip)]
167    #[serde(default)]
168    pub(crate) capabilities: Vec<String>,
169    /// Optional preferred compatibility track name.
170    #[new(skip)]
171    #[serde(default)]
172    #[get(skip)]
173    pub(crate) preferred_track: Option<String>,
174}