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 ExecutionSettlementCheckpointError, ExecutionSettlementPersistenceError,
44 checkpoint_execution_settlement, create_execution_settlement, read_execution_settlement,
45};
46pub use execution_workflow::{
47 ExecutionStageGuard, ExecutionStagePreparationError, ExecutionStageResumeError,
48 ExecutionWorkflowPersistenceError, create_execution_workflow, read_execution_workflow,
49};
50pub use fence_obligation::{
51 FenceObligationPersistenceError, FenceObligationRequirement, create_fence_obligation,
52 read_fence_obligation,
53};
54pub use inventory::{InventoryError, create_inventory, read_inventory};
55pub use journal_lock::{JournalLock, JournalLockError};
56pub use json::{create_json_durable, read_json, write_json_durable};
57pub use layout_lifetime::{BackupLayoutGuard, MAX_RESTORE_REFERENCE_BYTES};
58pub use operation_plan::{
59 OperationPlanPersistenceError, create_operation_plan, read_operation_plan,
60};
61pub use restore_safety::{
62 RestoreSafetyPersistenceError, create_restore_safety_requirement,
63 read_restore_safety_requirement,
64};
65
66use crate::{model::artifacts::ChecksumError, ops::artifacts::ArtifactError};
67use std::io;
68use thiserror::Error;
69
70#[derive(Debug, Error)]
72pub enum PersistenceError {
73 #[error("backup layout changed while held: {path:?}")]
75 LayoutChanged {
76 path: std::path::PathBuf,
78 },
79 #[error("unsafe restore reference entry: {path:?}")]
81 InvalidRestoreReferences {
82 path: std::path::PathBuf,
84 },
85 #[error(transparent)]
87 RestoreReference(#[from] crate::model::restore_references::RestoreReferenceError),
88 #[error(transparent)]
91 Io(#[from] io::Error),
92 #[error(transparent)]
95 Publication(#[from] ic_host_fs::durable::NamedWriteError<io::Error>),
96 #[error(transparent)]
98 Json(#[from] serde_json::Error),
99 #[error("record exceeds byte limit {limit}")]
101 RecordTooLarge {
102 limit: u64,
104 },
105 #[error(transparent)]
107 Artifact(#[from] ArtifactError),
108 #[error(transparent)]
110 Checksum(#[from] ChecksumError),
111 #[error("artifact commit paths must be distinct siblings: {temporary}, {canonical}")]
113 ArtifactCommitPathMismatch {
114 temporary: String,
116 canonical: String,
118 },
119 #[error("artifact commit has conflicting paths: {temporary}, {canonical}")]
121 ArtifactCommitPathConflict {
122 temporary: String,
124 canonical: String,
126 },
127 #[error("artifact commit is missing both paths: {temporary}, {canonical}")]
129 ArtifactCommitPathMissing {
130 temporary: String,
132 canonical: String,
134 },
135 #[error("durable artifact publication is unsupported on {platform}")]
137 ArtifactCommitUnsupportedPlatform {
138 platform: &'static str,
140 },
141 #[error("unsupported artifact entry at {path}: {kind}")]
143 UnsupportedArtifactEntry {
144 path: String,
146 kind: String,
148 },
149}