use super::audit;
use crate::error::Result;
use std::path::{Path, PathBuf};
use std::sync::Mutex;
#[derive(Debug)]
pub(in crate::store) struct DerivedRepairPublication {
directory: PathBuf,
record: Mutex<audit::DerivedRepairAuditRecord>,
}
impl DerivedRepairPublication {
pub(super) fn from_prepared(directory: &Path, record: audit::DerivedRepairAuditRecord) -> Self {
Self {
directory: directory.to_path_buf(),
record: Mutex::new(record),
}
}
pub(in crate::store) fn record_target_head(
&self,
target: &crate::branch_head::BranchHead,
) -> Result<()> {
let mut record = self
.record
.lock()
.unwrap_or_else(|error| error.into_inner());
audit::record_target_head(&self.directory, &mut record, target)
}
}