Implements the legacy behaviour of the dump
When asked if a dump exists we check if it's the current dump, and if
it's not then we check on the filesystem for any file matching our
`uid.dump`
@@ -182,12 +182,20 @@ where
async fn handle_dump_info(&self, uid: String) -> DumpResult<DumpInfo> {
match &*self.dump_info.lock().await {
- None => Err(DumpError::DumpDoesNotExist(uid)),
- Some(DumpInfo { uid: ref s, .. }) if &uid != s => Err(DumpError::DumpDoesNotExist(uid)),
+ None => self.dump_from_fs(uid).await,
+ Some(DumpInfo { uid: ref s, .. }) if &uid != s => self.dump_from_fs(uid).await,
Some(info) => Ok(info.clone()),
}
}
+ async fn dump_from_fs(&self, uid: String) -> DumpResult<DumpInfo> {
+ self.dump_path
+ .join(format!("{}.dump", &uid))
+ .exists()
+ .then(|| DumpInfo::new(uid.clone(), DumpStatus::Done))
+ .ok_or(DumpError::DumpDoesNotExist(uid))
+ }
+
async fn is_running(&self) -> bool {
matches!(
*self.dump_info.lock().await,
