2026-03-09 08:48:05 +01:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
2026-03-10 11:08:17 +01:00
|
|
|
use crate::NodeArtifactFile;
|
2026-03-09 08:48:05 +01:00
|
|
|
|
2026-03-12 07:35:22 +01:00
|
|
|
/// Static cfgsync artifact bundle.
|
|
|
|
|
///
|
|
|
|
|
/// This is the bundle-oriented source format used when all artifacts are known
|
|
|
|
|
/// ahead of time and no registration-time materialization is required.
|
2026-03-09 08:48:05 +01:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2026-03-10 11:08:17 +01:00
|
|
|
pub struct NodeArtifactsBundle {
|
2026-03-12 07:35:22 +01:00
|
|
|
/// Per-node artifact entries keyed by identifier.
|
2026-03-10 11:08:17 +01:00
|
|
|
pub nodes: Vec<NodeArtifactsBundleEntry>,
|
2026-03-12 07:35:22 +01:00
|
|
|
/// Files that should be served alongside every node-specific entry.
|
2026-03-10 14:24:00 +01:00
|
|
|
#[serde(default)]
|
|
|
|
|
pub shared_files: Vec<NodeArtifactFile>,
|
2026-03-09 08:48:05 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-10 11:08:17 +01:00
|
|
|
impl NodeArtifactsBundle {
|
2026-03-12 07:35:22 +01:00
|
|
|
/// Creates a bundle with node-specific entries only.
|
2026-03-09 08:48:05 +01:00
|
|
|
#[must_use]
|
2026-03-10 11:08:17 +01:00
|
|
|
pub fn new(nodes: Vec<NodeArtifactsBundleEntry>) -> Self {
|
2026-03-10 14:24:00 +01:00
|
|
|
Self {
|
|
|
|
|
nodes,
|
|
|
|
|
shared_files: Vec::new(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 07:35:22 +01:00
|
|
|
/// Attaches files that should be served alongside every node entry.
|
2026-03-10 14:24:00 +01:00
|
|
|
#[must_use]
|
|
|
|
|
pub fn with_shared_files(mut self, shared_files: Vec<NodeArtifactFile>) -> Self {
|
|
|
|
|
self.shared_files = shared_files;
|
|
|
|
|
self
|
2026-03-09 08:48:05 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 07:35:22 +01:00
|
|
|
/// One node entry inside a static cfgsync bundle.
|
2026-03-09 08:48:05 +01:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2026-03-10 11:08:17 +01:00
|
|
|
pub struct NodeArtifactsBundleEntry {
|
2026-03-09 08:48:05 +01:00
|
|
|
/// Stable node identifier used by cfgsync lookup.
|
|
|
|
|
pub identifier: String,
|
|
|
|
|
/// Files that should be materialized for the node.
|
|
|
|
|
#[serde(default)]
|
2026-03-10 11:08:17 +01:00
|
|
|
pub files: Vec<NodeArtifactFile>,
|
2026-03-09 08:48:05 +01:00
|
|
|
}
|