mod artifact_commit;
mod command_lifetime_lock;
mod file_lock;
mod journal_lock;
mod json;
mod layout_lifetime;
pub use artifact_commit::{ArtifactCommitOutcome, commit_artifact_directory};
pub use command_lifetime_lock::{
COMMAND_CUSTODY_DESCRIPTOR_ENV, CommandLifetimeLock, CommandLifetimeLockError,
CommandQuiescenceGuard,
};
pub use journal_lock::{JournalLock, JournalLockError};
pub use json::{create_json_durable, read_json, write_json_durable};
pub use layout_lifetime::{BackupLayoutGuard, MAX_RESTORE_REFERENCE_BYTES};
use crate::{model::artifacts::ChecksumError, ops::artifacts::ArtifactError};
use std::io;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum PersistenceError {
#[error("backup layout changed while held: {path:?}")]
LayoutChanged {
path: std::path::PathBuf,
},
#[error("unsafe restore reference entry: {path:?}")]
InvalidRestoreReferences {
path: std::path::PathBuf,
},
#[error(transparent)]
RestoreReference(#[from] crate::model::restore_references::RestoreReferenceError),
#[error(transparent)]
Io(#[from] io::Error),
#[error(transparent)]
Json(#[from] serde_json::Error),
#[error("record exceeds byte limit {limit}")]
RecordTooLarge {
limit: u64,
},
#[error(transparent)]
Artifact(#[from] ArtifactError),
#[error(transparent)]
Checksum(#[from] ChecksumError),
#[error("artifact commit paths must be distinct siblings: {temporary}, {canonical}")]
ArtifactCommitPathMismatch {
temporary: String,
canonical: String,
},
#[error("artifact commit has conflicting paths: {temporary}, {canonical}")]
ArtifactCommitPathConflict {
temporary: String,
canonical: String,
},
#[error("artifact commit is missing both paths: {temporary}, {canonical}")]
ArtifactCommitPathMissing {
temporary: String,
canonical: String,
},
#[error("durable artifact publication is unsupported on {platform}")]
ArtifactCommitUnsupportedPlatform {
platform: &'static str,
},
#[error("unsupported artifact entry at {path}: {kind}")]
UnsupportedArtifactEntry {
path: String,
kind: String,
},
}