Skip to main content

canic_backup/persistence/integrity/
reports.rs

1//! Module: persistence::integrity::reports
2//!
3//! Responsibility: define read-only backup integrity report projections.
4//! Does not own: integrity verification, persistence, or restore execution.
5//! Boundary: exposes serializable report DTOs for persistence callers.
6
7use serde::{Deserialize, Serialize};
8
9///
10/// BackupIntegrityReport
11///
12/// Read-only integrity projection for manifest, journal, and artifact checks.
13/// Owned by persistence integrity and returned by backup layout verification.
14///
15
16#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
17#[serde(deny_unknown_fields)]
18pub struct BackupIntegrityReport {
19    pub backup_id: String,
20    pub verified: bool,
21    pub manifest_members: usize,
22    pub journal_artifacts: usize,
23    pub durable_artifacts: usize,
24    pub artifacts: Vec<ArtifactIntegrityReport>,
25}
26
27///
28/// BackupExecutionIntegrityReport
29///
30/// Read-only integrity projection for backup plan and execution journal checks.
31/// Owned by persistence integrity and returned by execution resume verification.
32///
33
34#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
35#[serde(deny_unknown_fields)]
36pub struct BackupExecutionIntegrityReport {
37    pub plan_id: String,
38    pub run_id: String,
39    pub verified: bool,
40    pub plan_operations: usize,
41    pub journal_operations: usize,
42}
43
44///
45/// ArtifactIntegrityReport
46///
47/// Read-only integrity projection for one durable artifact.
48/// Owned by persistence integrity and embedded in backup integrity reports.
49///
50
51#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
52#[serde(deny_unknown_fields)]
53pub struct ArtifactIntegrityReport {
54    pub canister_id: String,
55    pub snapshot_id: String,
56    pub artifact_path: String,
57    pub checksum: String,
58}