ic_backup/ops/persistence/
mod.rs1mod artifact_commit;
4mod attempt_journal;
5mod command_lifetime_lock;
6mod consistency;
7mod download_journal;
8mod effect_graph;
9mod execution_progress;
10mod execution_settlement;
11mod execution_workflow;
12mod fence_obligation;
13mod file_lock;
14mod inventory;
15mod journal_lock;
16mod json;
17mod layout_lifetime;
18mod operation_plan;
19mod restore_safety;
20
21pub use artifact_commit::{ArtifactCommitOutcome, commit_artifact_directory};
22pub use attempt_journal::{AttemptJournalError, AttemptJournalGuard};
23pub use command_lifetime_lock::{
24 COMMAND_CUSTODY_DESCRIPTOR_ENV, CommandLifetimeLock, CommandLifetimeLockError,
25 CommandQuiescenceGuard,
26};
27pub use consistency::{
28 ConsistencyPersistenceError, create_consistency_requirement, read_consistency_requirement,
29};
30pub use download_journal::{
31 DownloadIntegrityError, DownloadJournalError, DownloadJournalGuard, DownloadManifestError,
32 LocalRestoreArtifactError, LocalRestoreArtifactPublicationError, LocalRestoreArtifactView,
33 LocalRestoreSourceError, read_download_manifest,
34};
35#[cfg(unix)]
36pub use download_journal::{
37 IcSnapshotArtifactError, IcSnapshotArtifactWriter, IcSnapshotLocalMetrics,
38 IcSnapshotUploadArtifactError, MeasurementHistogram, MeasurementSummary,
39};
40pub use effect_graph::{EffectGraphPersistenceError, create_effect_graph, read_effect_graph};
41pub use execution_progress::{ExecutionProgressPersistenceError, read_execution_progress};
42pub use execution_settlement::{
43 ExecutionSettlementPersistenceError, create_execution_settlement, read_execution_settlement,
44};
45pub use execution_workflow::{
46 ExecutionStageGuard, ExecutionStagePreparationError, ExecutionStageResumeError,
47 ExecutionWorkflowPersistenceError, create_execution_workflow, read_execution_workflow,
48};
49pub use fence_obligation::{
50 FenceObligationPersistenceError, FenceObligationRequirement, create_fence_obligation,
51 read_fence_obligation,
52};
53pub use inventory::{InventoryError, create_inventory, read_inventory};
54pub use journal_lock::{JournalLock, JournalLockError};
55pub use json::{create_json_durable, read_json, write_json_durable};
56pub use layout_lifetime::{BackupLayoutGuard, MAX_RESTORE_REFERENCE_BYTES};
57pub use operation_plan::{
58 OperationPlanPersistenceError, create_operation_plan, read_operation_plan,
59};
60pub use restore_safety::{
61 RestoreSafetyPersistenceError, create_restore_safety_requirement,
62 read_restore_safety_requirement,
63};
64
65use crate::{model::artifacts::ChecksumError, ops::artifacts::ArtifactError};
66use std::io;
67use thiserror::Error;
68
69#[derive(Debug, Error)]
71pub enum PersistenceError {
72 #[error("backup layout changed while held: {path:?}")]
74 LayoutChanged {
75 path: std::path::PathBuf,
77 },
78 #[error("unsafe restore reference entry: {path:?}")]
80 InvalidRestoreReferences {
81 path: std::path::PathBuf,
83 },
84 #[error(transparent)]
86 RestoreReference(#[from] crate::model::restore_references::RestoreReferenceError),
87 #[error(transparent)]
90 Io(#[from] io::Error),
91 #[error(transparent)]
94 Publication(#[from] ic_host_fs::durable::NamedWriteError<io::Error>),
95 #[error(transparent)]
97 Json(#[from] serde_json::Error),
98 #[error("record exceeds byte limit {limit}")]
100 RecordTooLarge {
101 limit: u64,
103 },
104 #[error(transparent)]
106 Artifact(#[from] ArtifactError),
107 #[error(transparent)]
109 Checksum(#[from] ChecksumError),
110 #[error("artifact commit paths must be distinct siblings: {temporary}, {canonical}")]
112 ArtifactCommitPathMismatch {
113 temporary: String,
115 canonical: String,
117 },
118 #[error("artifact commit has conflicting paths: {temporary}, {canonical}")]
120 ArtifactCommitPathConflict {
121 temporary: String,
123 canonical: String,
125 },
126 #[error("artifact commit is missing both paths: {temporary}, {canonical}")]
128 ArtifactCommitPathMissing {
129 temporary: String,
131 canonical: String,
133 },
134 #[error("durable artifact publication is unsupported on {platform}")]
136 ArtifactCommitUnsupportedPlatform {
137 platform: &'static str,
139 },
140 #[error("unsupported artifact entry at {path}: {kind}")]
142 UnsupportedArtifactEntry {
143 path: String,
145 kind: String,
147 },
148}