Conversation
| #[derive(Copy, Clone, Debug, PartialEq, Eq)] | ||
| pub enum HubrisArchiveDoneness { | ||
| /// Fully load archive | ||
| Cook, | ||
| /// Load archive into memory, but do not otherwise process | ||
| Raw, | ||
| } | ||
|
|
There was a problem hiding this comment.
Getting rid of this works fine but it makes the CI tests take longer, probably because they now have to do the full hubris archive load for extract. I think I'm going to bring this back and fix extract instead.
c4c3a45 to
a871a18
Compare
Early hubris archives were tagged with version v1.0.0. Newer versions are a single integer. Rather than hack around this in the version parsing, just remove the old cores.
| let mut objects = (0..hubris.file_count()?) | ||
| .into_par_iter() | ||
| .map(|i| -> Result<Option<(usize, String, Vec<u8>)>> { | ||
| // ZipArchive is cheap to clone since the backing is cheap | ||
| let mut archive = archive.clone(); | ||
| let mut file = archive.by_index(i)?; | ||
| let path = Path::new(file.name()); | ||
| let archive = hubris.clone(); | ||
|
|
||
| let (name, data) = archive.extract_file_by_index(i)?; | ||
| let path = Path::new(&name); |
There was a problem hiding this comment.
I wrote some of this code a few years ago but had a cryptic commit message about it being too slow. If I had to guess it was this code which was too slow (maybe before we even had parallel iteration) but we basically match mainline if we let the archive be cloneable oxidecomputer/hubtools#63
There was a problem hiding this comment.
Following up on my comments from the hubtools PR, I don't think the cloning is necessary here:
| let mut objects = (0..hubris.file_count()?) | |
| .into_par_iter() | |
| .map(|i| -> Result<Option<(usize, String, Vec<u8>)>> { | |
| // ZipArchive is cheap to clone since the backing is cheap | |
| let mut archive = archive.clone(); | |
| let mut file = archive.by_index(i)?; | |
| let path = Path::new(file.name()); | |
| let archive = hubris.clone(); | |
| let (name, data) = archive.extract_file_by_index(i)?; | |
| let path = Path::new(&name); | |
| let mut objects = (0..hubris.file_count()?) | |
| .into_par_iter() | |
| .map(|i| -> Result<Option<(usize, String, Vec<u8>)>> { | |
| let (name, data) = hubris.extract_file_by_index(i)?; | |
| let path = Path::new(&name); |
There was a problem hiding this comment.
Ahhhh I see now that there were mutable shenanigans going on with the ZipArchive but that's not the case here.
| let archive = RawHubrisArchive::from_vec(hubris.zip.clone())?; | ||
|
|
||
| // ZipArchive is cheap to clone since the backing is cheap | ||
| let (name, data) = archive.extract_file_by_index(i)?; |
There was a problem hiding this comment.
Similarly,
| let archive = RawHubrisArchive::from_vec(hubris.zip.clone())?; | |
| // ZipArchive is cheap to clone since the backing is cheap | |
| let (name, data) = archive.extract_file_by_index(i)?; | |
| let (name, data) = hubris.extract_file_by_index(i)?; |
When humility/hubris were first developed we didn't have many details of the hubris archive beyond "it's a zip". We've since developed a separate library for hubris manipulation. Let humility use it too.
When humility/hubris were first developed we didn't have many details of the hubris archive beyond "it's a zip". We've since developed a separate library for hubris manipulation. Let humility use it too.