Run Manifest parsing in block_in_place mode

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-23 19:55:09 +10:00
parent 60caa9ee17
commit e18ac6e117
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
4 changed files with 25 additions and 27 deletions

View file

@ -29,23 +29,11 @@ impl ManifestVisitor {
vfs: Vfs::new(),
}
}
/// Load binstall metadata using the extracted information stored in memory.
pub(super) fn load_manifest(&self) -> Result<Manifest<Meta>, BinstallError> {
debug!("Loading manifest directly from extracted file");
// Load and parse manifest
let mut manifest = Manifest::<Meta>::from_slice_with_metadata(&self.cargo_toml_content)?;
// Checks vfs for binary output names
manifest.complete_from_abstract_filesystem(&self.vfs)?;
// Return metadata
Ok(manifest)
}
}
impl TarEntriesVisitor for ManifestVisitor {
type Target = Manifest<Meta>;
fn visit<R: Read>(&mut self, entries: Entries<'_, R>) -> Result<(), BinstallError> {
for res in entries {
let mut entry = res?;
@ -78,4 +66,18 @@ impl TarEntriesVisitor for ManifestVisitor {
Ok(())
}
/// Load binstall metadata using the extracted information stored in memory.
fn finish(self) -> Result<Self::Target, BinstallError> {
debug!("Loading manifest directly from extracted file");
// Load and parse manifest
let mut manifest = Manifest::from_slice_with_metadata(&self.cargo_toml_content)?;
// Checks vfs for binary output names
manifest.complete_from_abstract_filesystem(&self.vfs)?;
// Return metadata
Ok(manifest)
}
}