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, IcSnapshotDataUploadPreparationError,
38 IcSnapshotLocalMetrics, IcSnapshotUploadArtifactError, MeasurementHistogram,
39 MeasurementSummary,
40};
41pub use effect_graph::{EffectGraphPersistenceError, create_effect_graph, read_effect_graph};
42pub use execution_progress::{ExecutionProgressPersistenceError, read_execution_progress};
43pub use execution_settlement::{
44 ExecutionSettlementCheckpointError, ExecutionSettlementPersistenceError,
45 checkpoint_execution_settlement, create_execution_settlement, read_execution_settlement,
46};
47pub use execution_workflow::{
48 ExecutionStageCheckpointError, ExecutionStageGuard, ExecutionStagePreparationError,
49 ExecutionStageResumeError, ExecutionWorkflowPersistenceError, create_execution_workflow,
50 read_execution_workflow,
51};
52pub use fence_obligation::{
53 FenceObligationPersistenceError, FenceObligationRequirement, create_fence_obligation,
54 read_fence_obligation,
55};
56pub use inventory::{InventoryError, create_inventory, read_inventory};
57pub use journal_lock::{JournalLock, JournalLockError};
58pub use json::{create_json_durable, read_json, write_json_durable};
59pub use layout_lifetime::{BackupLayoutGuard, MAX_RESTORE_REFERENCE_BYTES};
60pub use operation_plan::{
61 OperationPlanPersistenceError, create_operation_plan, read_operation_plan,
62};
63pub use restore_safety::{
64 RestoreSafetyPersistenceError, create_restore_safety_requirement,
65 read_restore_safety_requirement,
66};
67
68use crate::{model::artifacts::ChecksumError, ops::artifacts::ArtifactError};
69use std::io;
70use thiserror::Error;
71
72#[derive(Debug, Error)]
74pub enum PersistenceError {
75 #[error("backup layout changed while held: {path:?}")]
77 LayoutChanged {
78 path: std::path::PathBuf,
80 },
81 #[error("unsafe restore reference entry: {path:?}")]
83 InvalidRestoreReferences {
84 path: std::path::PathBuf,
86 },
87 #[error(transparent)]
89 RestoreReference(#[from] crate::model::restore_references::RestoreReferenceError),
90 #[error(transparent)]
93 Io(#[from] io::Error),
94 #[error(transparent)]
97 Publication(#[from] ic_host_fs::durable::NamedWriteError<io::Error>),
98 #[error(transparent)]
100 Json(#[from] serde_json::Error),
101 #[error("record exceeds byte limit {limit}")]
103 RecordTooLarge {
104 limit: u64,
106 },
107 #[error(transparent)]
109 Artifact(#[from] ArtifactError),
110 #[error(transparent)]
112 Checksum(#[from] ChecksumError),
113 #[error("artifact commit paths must be distinct siblings: {temporary}, {canonical}")]
115 ArtifactCommitPathMismatch {
116 temporary: String,
118 canonical: String,
120 },
121 #[error("artifact commit has conflicting paths: {temporary}, {canonical}")]
123 ArtifactCommitPathConflict {
124 temporary: String,
126 canonical: String,
128 },
129 #[error("artifact commit is missing both paths: {temporary}, {canonical}")]
131 ArtifactCommitPathMissing {
132 temporary: String,
134 canonical: String,
136 },
137 #[error("durable artifact publication is unsupported on {platform}")]
139 ArtifactCommitUnsupportedPlatform {
140 platform: &'static str,
142 },
143 #[error("unsupported artifact entry at {path}: {kind}")]
145 UnsupportedArtifactEntry {
146 path: String,
148 kind: String,
150 },
151}