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_settlement;
10mod fence_obligation;
11mod file_lock;
12mod inventory;
13mod journal_lock;
14mod json;
15mod layout_lifetime;
16mod operation_plan;
17mod restore_safety;
18
19pub use artifact_commit::{ArtifactCommitOutcome, commit_artifact_directory};
20pub use attempt_journal::{AttemptJournalError, AttemptJournalGuard};
21pub use command_lifetime_lock::{
22 COMMAND_CUSTODY_DESCRIPTOR_ENV, CommandLifetimeLock, CommandLifetimeLockError,
23 CommandQuiescenceGuard,
24};
25pub use consistency::{
26 ConsistencyPersistenceError, create_consistency_requirement, read_consistency_requirement,
27};
28pub use download_journal::{
29 DownloadIntegrityError, DownloadJournalError, DownloadJournalGuard, DownloadManifestError,
30 LocalRestoreArtifactError, LocalRestoreArtifactPublicationError, LocalRestoreArtifactView,
31 LocalRestoreSourceError, read_download_manifest,
32};
33pub use effect_graph::{EffectGraphPersistenceError, create_effect_graph, read_effect_graph};
34pub use execution_settlement::{
35 ExecutionSettlementPersistenceError, create_execution_settlement, read_execution_settlement,
36};
37pub use fence_obligation::{
38 FenceObligationPersistenceError, FenceObligationRequirement, create_fence_obligation,
39 read_fence_obligation,
40};
41pub use inventory::{InventoryError, create_inventory, read_inventory};
42pub use journal_lock::{JournalLock, JournalLockError};
43pub use json::{create_json_durable, read_json, write_json_durable};
44pub use layout_lifetime::{BackupLayoutGuard, MAX_RESTORE_REFERENCE_BYTES};
45pub use operation_plan::{
46 OperationPlanPersistenceError, create_operation_plan, read_operation_plan,
47};
48pub use restore_safety::{
49 RestoreSafetyPersistenceError, create_restore_safety_requirement,
50 read_restore_safety_requirement,
51};
52
53use crate::{model::artifacts::ChecksumError, ops::artifacts::ArtifactError};
54use std::io;
55use thiserror::Error;
56
57#[derive(Debug, Error)]
59pub enum PersistenceError {
60 #[error("backup layout changed while held: {path:?}")]
62 LayoutChanged {
63 path: std::path::PathBuf,
65 },
66 #[error("unsafe restore reference entry: {path:?}")]
68 InvalidRestoreReferences {
69 path: std::path::PathBuf,
71 },
72 #[error(transparent)]
74 RestoreReference(#[from] crate::model::restore_references::RestoreReferenceError),
75 #[error(transparent)]
77 Io(#[from] io::Error),
78 #[error(transparent)]
80 Json(#[from] serde_json::Error),
81 #[error("record exceeds byte limit {limit}")]
83 RecordTooLarge {
84 limit: u64,
86 },
87 #[error(transparent)]
89 Artifact(#[from] ArtifactError),
90 #[error(transparent)]
92 Checksum(#[from] ChecksumError),
93 #[error("artifact commit paths must be distinct siblings: {temporary}, {canonical}")]
95 ArtifactCommitPathMismatch {
96 temporary: String,
98 canonical: String,
100 },
101 #[error("artifact commit has conflicting paths: {temporary}, {canonical}")]
103 ArtifactCommitPathConflict {
104 temporary: String,
106 canonical: String,
108 },
109 #[error("artifact commit is missing both paths: {temporary}, {canonical}")]
111 ArtifactCommitPathMissing {
112 temporary: String,
114 canonical: String,
116 },
117 #[error("durable artifact publication is unsupported on {platform}")]
119 ArtifactCommitUnsupportedPlatform {
120 platform: &'static str,
122 },
123 #[error("unsupported artifact entry at {path}: {kind}")]
125 UnsupportedArtifactEntry {
126 path: String,
128 kind: String,
130 },
131}