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, MeasurementAggregate,
39 MeasurementHistogram, 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 reconcile_execution_settlement, replay_execution_settlement,
47};
48pub use execution_workflow::{
49 ExecutionStageCheckpointError, ExecutionStageGuard, ExecutionStagePreparationError,
50 ExecutionStageResumeError, ExecutionStageSettlementView, ExecutionWorkflowPersistenceError,
51 ExecutionWorkflowSettlementView, create_execution_workflow, read_complete_execution_workflow,
52 read_execution_workflow,
53};
54pub use fence_obligation::{
55 FenceObligationPersistenceError, FenceObligationRequirement, create_fence_obligation,
56 read_fence_obligation,
57};
58pub use inventory::{InventoryError, create_inventory, read_inventory};
59pub use journal_lock::{JournalLock, JournalLockError};
60pub use json::{create_json_durable, read_json, write_json_durable};
61pub use layout_lifetime::{BackupLayoutGuard, MAX_RESTORE_REFERENCE_BYTES};
62pub use operation_plan::{
63 OperationPlanPersistenceError, create_operation_plan, read_operation_plan,
64};
65pub use restore_safety::{
66 RestoreSafetyPersistenceError, create_restore_safety_requirement,
67 read_restore_safety_requirement,
68};
69
70use crate::{model::artifacts::ChecksumError, ops::artifacts::ArtifactError};
71use std::io;
72use thiserror::Error;
73
74#[derive(Debug, Error)]
76pub enum PersistenceError {
77 #[error("backup layout changed while held: {path:?}")]
79 LayoutChanged {
80 path: std::path::PathBuf,
82 },
83 #[error("unsafe restore reference entry: {path:?}")]
85 InvalidRestoreReferences {
86 path: std::path::PathBuf,
88 },
89 #[error(transparent)]
91 RestoreReference(#[from] crate::model::restore_references::RestoreReferenceError),
92 #[error(transparent)]
95 Io(#[from] io::Error),
96 #[error(transparent)]
99 Publication(#[from] ic_host_fs::durable::NamedWriteError<io::Error>),
100 #[error(transparent)]
102 Json(#[from] serde_json::Error),
103 #[error("record exceeds byte limit {limit}")]
105 RecordTooLarge {
106 limit: u64,
108 },
109 #[error(transparent)]
111 Artifact(#[from] ArtifactError),
112 #[error(transparent)]
114 Checksum(#[from] ChecksumError),
115 #[error("artifact commit paths must be distinct siblings: {temporary}, {canonical}")]
117 ArtifactCommitPathMismatch {
118 temporary: String,
120 canonical: String,
122 },
123 #[error("artifact commit has conflicting paths: {temporary}, {canonical}")]
125 ArtifactCommitPathConflict {
126 temporary: String,
128 canonical: String,
130 },
131 #[error("artifact commit is missing both paths: {temporary}, {canonical}")]
133 ArtifactCommitPathMissing {
134 temporary: String,
136 canonical: String,
138 },
139 #[error("durable artifact publication is unsupported on {platform}")]
141 ArtifactCommitUnsupportedPlatform {
142 platform: &'static str,
144 },
145 #[error("unsupported artifact entry at {path}: {kind}")]
147 UnsupportedArtifactEntry {
148 path: String,
150 kind: String,
152 },
153}