Complete nested prepared-lower reclaim ordering
This commit is contained in:
parent
0dfd7767b5
commit
898271c430
1 changed files with 74 additions and 4 deletions
|
|
@ -234,8 +234,8 @@ impl PreparedLowerStore {
|
|||
.context("canonical replacement exists without quarantined old artifact")?;
|
||||
require_identity(&quarantined, reclaiming.device, reclaiming.inode)?;
|
||||
let replacement = self
|
||||
.available_artifact(reclaiming.prepared_artifact_id)?
|
||||
.context("canonical replacement exists without available ownership")?;
|
||||
.catalog_artifact(reclaiming.prepared_artifact_id)?
|
||||
.context("canonical replacement exists without catalog ownership")?;
|
||||
require_identity(&canonical, replacement.device, replacement.inode)?;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -252,8 +252,8 @@ impl PreparedLowerStore {
|
|||
row: CatalogRow::PreparedArtifact,
|
||||
}) => {
|
||||
let replacement = self
|
||||
.available_artifact(reclaiming.prepared_artifact_id)?
|
||||
.context("reclaim row changed without an available replacement")?;
|
||||
.catalog_artifact(reclaiming.prepared_artifact_id)?
|
||||
.context("reclaim row changed without an owned replacement")?;
|
||||
self.require_artifact_identity(&replacement)?;
|
||||
Ok(ReclaimOutcome::ReplacementPreserved)
|
||||
}
|
||||
|
|
@ -334,6 +334,15 @@ impl PreparedLowerStore {
|
|||
}))
|
||||
}
|
||||
|
||||
fn catalog_artifact(&self, id: PreparedArtifactId) -> Result<Option<PreparedArtifact>> {
|
||||
Ok(self
|
||||
.catalog
|
||||
.snapshot()?
|
||||
.prepared_artifacts
|
||||
.into_iter()
|
||||
.find(|artifact| artifact.prepared_artifact_id == id))
|
||||
}
|
||||
|
||||
fn require_artifact_identity(&self, artifact: &PreparedArtifact) -> Result<()> {
|
||||
let path = PathBuf::from(std::ffi::OsString::from_vec(
|
||||
artifact.path.as_bytes().to_vec(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue