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 immutable_record;
15mod inventory;
16mod journal_lock;
17mod json;
18mod layout_lifetime;
19mod operation_plan;
20mod publication_error;
21mod restore_reference_release;
22mod restore_safety;
23
24pub use artifact_commit::{ArtifactCommitOutcome, commit_artifact_directory};
25pub use attempt_journal::{AttemptJournalError, AttemptJournalGuard};
26pub use command_lifetime_lock::{
27 COMMAND_CUSTODY_DESCRIPTOR_ENV, CommandLifetimeLock, CommandLifetimeLockError,
28 CommandQuiescenceGuard,
29};
30pub use consistency::{
31 ConsistencyPersistenceError, create_consistency_requirement, read_consistency_requirement,
32};
33pub use download_journal::{
34 DownloadIntegrityError, DownloadJournalError, DownloadJournalGuard, DownloadManifestError,
35 LocalRestoreSourceError, read_download_manifest,
36};
37#[cfg(unix)]
38pub use download_journal::{
39 IcSnapshotArtifactError, IcSnapshotArtifactWriter, IcSnapshotDataUploadPreparationError,
40 IcSnapshotLocalMetrics, IcSnapshotUploadArtifactError, MeasurementAggregate,
41 MeasurementHistogram, MeasurementSummary,
42};
43pub use effect_graph::{EffectGraphPersistenceError, create_effect_graph, read_effect_graph};
44pub use execution_progress::{ExecutionProgressPersistenceError, read_execution_progress};
45pub use execution_settlement::{
46 ExecutionSettlementCheckpointError, ExecutionSettlementPersistenceError,
47 checkpoint_execution_settlement, create_execution_settlement, read_execution_settlement,
48 reconcile_execution_settlement, replay_execution_settlement,
49};
50pub(crate) use execution_workflow::read_execution_stage_occupancy;
51pub use execution_workflow::{
52 ExecutionStageCheckpointError, ExecutionStageGuard, ExecutionStagePreparationError,
53 ExecutionStageResumeError, ExecutionStageSettlementView, ExecutionWorkflowPersistenceError,
54 ExecutionWorkflowSettlementView, create_execution_workflow, read_complete_execution_workflow,
55 read_execution_workflow,
56};
57pub use fence_obligation::{
58 FenceObligationPersistenceError, FenceObligationRequirement, create_fence_obligation,
59 read_fence_obligation,
60};
61pub use inventory::{InventoryError, create_inventory, read_inventory};
62pub use journal_lock::{JournalLock, JournalLockError};
63pub use json::{create_json_durable, read_json, write_json_durable};
64pub use layout_lifetime::{BackupLayoutGuard, MAX_RESTORE_REFERENCE_BYTES};
65pub use operation_plan::{
66 OperationPlanPersistenceError, create_operation_plan, read_operation_plan,
67};
68pub use publication_error::PublicationError;
69pub use restore_reference_release::{
70 MAX_RESTORE_TERMINAL_BYTES, RestoreReferenceReleaseError, RestoreReferenceReleaseOutcome,
71 RestoreTerminalEvidenceProvider,
72};
73pub use restore_safety::{
74 RestoreSafetyPersistenceError, create_restore_safety_requirement,
75 read_restore_safety_requirement,
76};
77
78use crate::{model::artifacts::ChecksumError, ops::artifacts::ArtifactError};
79use std::io;
80use thiserror::Error;
81
82#[derive(Debug, Error)]
84pub enum PersistenceError {
85 #[error("backup layout changed while held: {path:?}")]
87 LayoutChanged {
88 path: std::path::PathBuf,
90 },
91 #[error("unsafe restore reference entry: {path:?}")]
93 InvalidRestoreReferences {
94 path: std::path::PathBuf,
96 },
97 #[error(transparent)]
99 RestoreReference(#[from] crate::model::restore_references::RestoreReferenceError),
100 #[error(transparent)]
103 Io(#[from] io::Error),
104 #[error(transparent)]
107 Publication(#[from] PublicationError),
108 #[error(transparent)]
110 Json(#[from] serde_json::Error),
111 #[error("record exceeds byte limit {limit}")]
113 RecordTooLarge {
114 limit: u64,
116 },
117 #[error(transparent)]
119 Artifact(#[from] ArtifactError),
120 #[error(transparent)]
122 Checksum(#[from] ChecksumError),
123 #[error("artifact commit paths must be distinct siblings: {temporary}, {canonical}")]
125 ArtifactCommitPathMismatch {
126 temporary: String,
128 canonical: String,
130 },
131 #[error("artifact commit has conflicting paths: {temporary}, {canonical}")]
133 ArtifactCommitPathConflict {
134 temporary: String,
136 canonical: String,
138 },
139 #[error("artifact commit is missing both paths: {temporary}, {canonical}")]
141 ArtifactCommitPathMissing {
142 temporary: String,
144 canonical: String,
146 },
147 #[error("durable artifact publication is unsupported on {platform}")]
149 ArtifactCommitUnsupportedPlatform {
150 platform: &'static str,
152 },
153 #[error("unsupported artifact entry at {path}: {kind}")]
155 UnsupportedArtifactEntry {
156 path: String,
158 kind: String,
160 },
161}