Skip to content

Commit c967a36

Browse files
committed
wip
1 parent 77d6a82 commit c967a36

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/manifest.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
use crate::{FormatVersion, TreeType};
66
use byteorder::{ReadBytesExt, WriteBytesExt};
7-
use std::{io::Write, path::Path};
7+
use std::{
8+
io::{Read, Write},
9+
path::Path,
10+
};
811

912
pub struct Manifest {
1013
pub version: FormatVersion,
@@ -27,7 +30,7 @@ impl Manifest {
2730
writer.write_u8(self.level_count)?;
2831

2932
writer.start("filter_hash_type")?;
30-
writer.write_u8(0)?; // 0 = XXH3
33+
writer.write_all(b"xxh3")?;
3134

3235
Ok(())
3336
}
@@ -77,12 +80,17 @@ impl Manifest {
7780
.section(b"filter_hash_type")
7881
.expect("filter_hash_type section must exist in manifest");
7982

80-
let mut reader = section.buf_reader(path)?;
81-
reader.read_u8()?
83+
section
84+
.buf_reader(path)?
85+
.bytes()
86+
.collect::<Result<Vec<_>, _>>()?
8287
};
8388

8489
// Only one supported right now (and probably forever)
85-
assert_eq!(0, filter_hash_type, "filter_hash_type should be XXH3");
90+
assert_eq!(
91+
b"xxh3", &*filter_hash_type,
92+
"filter_hash_type should be XXH3"
93+
);
8694
}
8795

8896
Ok(Self {

0 commit comments

Comments
 (0)