ic_backup/ops/persistence/artifact_commit/
mod.rs1use crate::ops::persistence::PersistenceError;
8
9use std::path::Path;
10
11#[derive(Clone, Copy, Debug, Eq, PartialEq)]
13pub enum ArtifactCommitOutcome {
14 Published,
16 Recovered,
18}
19
20pub fn commit_artifact_directory(
28 temporary: &Path,
29 canonical: &Path,
30 expected_checksum: &str,
31) -> Result<ArtifactCommitOutcome, PersistenceError> {
32 #[cfg(any(target_os = "linux", target_os = "android", target_vendor = "apple"))]
33 {
34 supported::commit_with_hook(temporary, canonical, expected_checksum, |_, _| Ok(()))
35 }
36
37 #[cfg(not(any(target_os = "linux", target_os = "android", target_vendor = "apple")))]
38 {
39 let _ = (temporary, canonical, expected_checksum);
40 Err(PersistenceError::ArtifactCommitUnsupportedPlatform {
41 platform: std::env::consts::OS,
42 })
43 }
44}
45
46#[cfg(any(target_os = "linux", target_os = "android", target_vendor = "apple"))]
47mod supported;
48
49#[cfg(all(
50 test,
51 any(target_os = "linux", target_os = "android", target_vendor = "apple")
52))]
53mod regressions;
54#[cfg(all(
55 test,
56 any(target_os = "linux", target_os = "android", target_vendor = "apple")
57))]
58mod tests;