Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ fn pack_archive(

let archive = Archive {
header: HEADER,
version: 0,
compression,
hash: index_hash.clone(),
index,
Expand Down Expand Up @@ -1181,6 +1182,7 @@ fn archive_directory(

let archive = Archive {
header: HEADER,
version: 0,
compression: algorithm,
hash: hashed_index.hash.clone(),
index: archive_index,
Expand Down
8 changes: 8 additions & 0 deletions common/src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ where
T: ArchiveEntryData,
{
pub header: [u8; 4],
pub version: u8,
pub compression: CompressionAlgorithm,
pub hash: Hash,
pub index: Index,
Expand All @@ -172,6 +173,7 @@ where
writer: &mut impl Write,
) -> anyhow::Result<()> {
writer.write_all(&HEADER)?;
writer.write_all(&[self.version])?;
writer.write_all(&(self.compression as u16).to_be_bytes())?;
writer.write_all(&self.hash.hash)?;
writer.write_all(&self.index.to_data())?;
Expand Down Expand Up @@ -222,6 +224,10 @@ where
reader.read_exact(&mut header)?;
assert!(header == HEADER);

let mut version: [u8; 1] = [0; 1];
reader.read_exact(&mut version)?;
let version = version[0];

let mut compression: [u8; 2] = [0; 2];
reader.read_exact(&mut compression)?;

Expand Down Expand Up @@ -258,6 +264,7 @@ where

Ok(Archive {
header: HEADER,
version,
compression,
hash,
index,
Expand Down Expand Up @@ -502,6 +509,7 @@ mod tests {
let zero = Hash::from([0u8; 32]);
Archive {
header: HEADER,
version: 0,
compression,
hash: zero.clone(),
index: Index {
Expand Down
1 change: 1 addition & 0 deletions server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ async fn get_bundle(

let archive = Archive {
header: HEADER,
version: 0,
compression: config.archive.compression_format,
hash: index_hash.clone(),
index,
Expand Down
Loading