boatramp_types/file.rs
1//! A deployment's per-file descriptor and its precompressed variants — the
2//! immutable, content-addressed file metadata shared by routing and the wire
3//! format. Lives here (not in `boatramp-core::deploy`) so the edge Worker and
4//! the web console can parse manifests and route without pulling the full
5//! `DeployStore`/IO stack.
6
7use std::collections::BTreeMap;
8
9use serde::{Deserialize, Serialize};
10
11/// One file within a deployment manifest.
12#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
13pub struct FileEntry {
14 /// SHA-256 (hex) of the file's identity (uncompressed) contents — its blob key.
15 pub hash: String,
16 /// Size of the identity representation in bytes.
17 pub size: u64,
18 /// MIME content type, when known.
19 #[serde(default, skip_serializing_if = "Option::is_none")]
20 pub content_type: Option<String>,
21 /// Precompressed alternates by `Content-Encoding` token (`br`, `gzip`),
22 /// produced at `sync`. Each is a separate content-addressed blob the server
23 /// may serve when the client accepts that encoding.
24 #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
25 pub variants: BTreeMap<String, Variant>,
26}
27
28/// A precompressed alternate representation of a [`FileEntry`].
29#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
30pub struct Variant {
31 /// SHA-256 (hex) of the compressed bytes — its blob key.
32 pub hash: String,
33 /// Size of the compressed representation in bytes.
34 pub size: u64,
35}