ic_backup/ops/persistence/
mod.rs1mod artifact_commit;
4mod attempt_journal;
5mod command_lifetime_lock;
6mod download_journal;
7mod effect_graph;
8mod file_lock;
9mod inventory;
10mod journal_lock;
11mod json;
12mod layout_lifetime;
13mod operation_plan;
14
15pub use artifact_commit::{ArtifactCommitOutcome, commit_artifact_directory};
16pub use attempt_journal::{AttemptJournalError, AttemptJournalGuard};
17pub use command_lifetime_lock::{
18 COMMAND_CUSTODY_DESCRIPTOR_ENV, CommandLifetimeLock, CommandLifetimeLockError,
19 CommandQuiescenceGuard,
20};
21pub use download_journal::{DownloadJournalError, DownloadJournalGuard};
22pub use effect_graph::{EffectGraphPersistenceError, create_effect_graph, read_effect_graph};
23pub use inventory::{InventoryError, create_inventory, read_inventory};
24pub use journal_lock::{JournalLock, JournalLockError};
25pub use json::{create_json_durable, read_json, write_json_durable};
26pub use layout_lifetime::{BackupLayoutGuard, MAX_RESTORE_REFERENCE_BYTES};
27pub use operation_plan::{
28 OperationPlanPersistenceError, create_operation_plan, read_operation_plan,
29};
30
31use crate::{model::artifacts::ChecksumError, ops::artifacts::ArtifactError};
32use std::io;
33use thiserror::Error;
34
35#[derive(Debug, Error)]
37pub enum PersistenceError {
38 #[error("backup layout changed while held: {path:?}")]
40 LayoutChanged {
41 path: std::path::PathBuf,
43 },
44 #[error("unsafe restore reference entry: {path:?}")]
46 InvalidRestoreReferences {
47 path: std::path::PathBuf,
49 },
50 #[error(transparent)]
52 RestoreReference(#[from] crate::model::restore_references::RestoreReferenceError),
53 #[error(transparent)]
55 Io(#[from] io::Error),
56 #[error(transparent)]
58 Json(#[from] serde_json::Error),
59 #[error("record exceeds byte limit {limit}")]
61 RecordTooLarge {
62 limit: u64,
64 },
65 #[error(transparent)]
67 Artifact(#[from] ArtifactError),
68 #[error(transparent)]
70 Checksum(#[from] ChecksumError),
71 #[error("artifact commit paths must be distinct siblings: {temporary}, {canonical}")]
73 ArtifactCommitPathMismatch {
74 temporary: String,
76 canonical: String,
78 },
79 #[error("artifact commit has conflicting paths: {temporary}, {canonical}")]
81 ArtifactCommitPathConflict {
82 temporary: String,
84 canonical: String,
86 },
87 #[error("artifact commit is missing both paths: {temporary}, {canonical}")]
89 ArtifactCommitPathMissing {
90 temporary: String,
92 canonical: String,
94 },
95 #[error("durable artifact publication is unsupported on {platform}")]
97 ArtifactCommitUnsupportedPlatform {
98 platform: &'static str,
100 },
101 #[error("unsupported artifact entry at {path}: {kind}")]
103 UnsupportedArtifactEntry {
104 path: String,
106 kind: String,
108 },
109}