ic_backup/ops/persistence/
mod.rs1mod artifact_commit;
4mod attempt_journal;
5mod command_lifetime_lock;
6mod consistency;
7mod directory_custody;
8mod download_journal;
9mod effect_graph;
10mod execution_progress;
11mod execution_settlement;
12mod execution_workflow;
13mod fence_obligation;
14mod file_lock;
15mod immutable_record;
16mod inventory;
17mod journal_lock;
18mod json;
19mod layout_lifetime;
20mod operation_plan;
21mod publication_error;
22mod restore_reference_release;
23mod restore_safety;
24
25pub use artifact_commit::{ArtifactCommitOutcome, commit_artifact_directory};
26pub use attempt_journal::{AttemptJournalError, AttemptJournalGuard};
27pub use command_lifetime_lock::{
28 COMMAND_CUSTODY_DESCRIPTOR_ENV, CommandLifetimeLock, CommandLifetimeLockError,
29 CommandQuiescenceGuard,
30};
31pub use consistency::{
32 ConsistencyPersistenceError, create_consistency_requirement, read_consistency_requirement,
33};
34pub use download_journal::{
35 DownloadIntegrityError, DownloadJournalError, DownloadJournalGuard, DownloadManifestError,
36 LocalRestoreArtifactError, LocalRestoreArtifactPublicationError, LocalRestoreArtifactView,
37 LocalRestoreSourceError, read_download_manifest,
38};
39#[cfg(unix)]
40pub use download_journal::{
41 IcSnapshotArtifactError, IcSnapshotArtifactWriter, IcSnapshotDataUploadPreparationError,
42 IcSnapshotLocalMetrics, IcSnapshotUploadArtifactError, MeasurementAggregate,
43 MeasurementHistogram, MeasurementSummary,
44};
45pub use effect_graph::{EffectGraphPersistenceError, create_effect_graph, read_effect_graph};
46pub use execution_progress::{ExecutionProgressPersistenceError, read_execution_progress};
47pub use execution_settlement::{
48 ExecutionSettlementCheckpointError, ExecutionSettlementPersistenceError,
49 checkpoint_execution_settlement, create_execution_settlement, read_execution_settlement,
50 reconcile_execution_settlement, replay_execution_settlement,
51};
52pub(crate) use execution_workflow::read_execution_stage_occupancy;
53pub use execution_workflow::{
54 ExecutionStageCheckpointError, ExecutionStageGuard, ExecutionStagePreparationError,
55 ExecutionStageResumeError, ExecutionStageSettlementView, ExecutionWorkflowPersistenceError,
56 ExecutionWorkflowSettlementView, create_execution_workflow, read_complete_execution_workflow,
57 read_execution_workflow,
58};
59pub use fence_obligation::{
60 FenceObligationPersistenceError, FenceObligationRequirement, create_fence_obligation,
61 read_fence_obligation,
62};
63pub use inventory::{InventoryError, create_inventory, read_inventory};
64pub use journal_lock::{JournalLock, JournalLockError};
65pub use json::{create_json_durable, read_json, write_json_durable};
66pub use layout_lifetime::{BackupLayoutGuard, MAX_RESTORE_REFERENCE_BYTES};
67pub use operation_plan::{
68 OperationPlanPersistenceError, create_operation_plan, read_operation_plan,
69};
70pub use publication_error::PublicationError;
71pub use restore_reference_release::{
72 MAX_RESTORE_TERMINAL_BYTES, RestoreReferenceReleaseError, RestoreReferenceReleaseOutcome,
73 RestoreTerminalEvidenceProvider,
74};
75pub use restore_safety::{
76 RestoreSafetyPersistenceError, create_restore_safety_requirement,
77 read_restore_safety_requirement,
78};
79
80use crate::{model::artifacts::ChecksumError, ops::artifacts::ArtifactError};
81use std::io;
82use thiserror::Error;
83
84#[derive(Debug, Error)]
86pub enum PersistenceError {
87 #[error("backup layout changed while held: {path:?}")]
89 LayoutChanged {
90 path: std::path::PathBuf,
92 },
93 #[error("unsafe restore reference entry: {path:?}")]
95 InvalidRestoreReferences {
96 path: std::path::PathBuf,
98 },
99 #[error(transparent)]
101 RestoreReference(#[from] crate::model::restore_references::RestoreReferenceError),
102 #[error(transparent)]
105 Io(#[from] io::Error),
106 #[error(transparent)]
109 Publication(#[from] PublicationError),
110 #[error(transparent)]
112 Json(#[from] serde_json::Error),
113 #[error("record exceeds byte limit {limit}")]
115 RecordTooLarge {
116 limit: u64,
118 },
119 #[error(transparent)]
121 Artifact(#[from] ArtifactError),
122 #[error(transparent)]
124 Checksum(#[from] ChecksumError),
125 #[error("artifact commit paths must be distinct siblings: {temporary}, {canonical}")]
127 ArtifactCommitPathMismatch {
128 temporary: String,
130 canonical: String,
132 },
133 #[error("artifact commit has conflicting paths: {temporary}, {canonical}")]
135 ArtifactCommitPathConflict {
136 temporary: String,
138 canonical: String,
140 },
141 #[error("artifact commit is missing both paths: {temporary}, {canonical}")]
143 ArtifactCommitPathMissing {
144 temporary: String,
146 canonical: String,
148 },
149 #[error("durable artifact publication is unsupported on {platform}")]
151 ArtifactCommitUnsupportedPlatform {
152 platform: &'static str,
154 },
155 #[error("unsupported artifact entry at {path}: {kind}")]
157 UnsupportedArtifactEntry {
158 path: String,
160 kind: String,
162 },
163}