This commit is contained in:
Alex Mikhalev 2021-11-21 13:10:23 -08:00
parent b207c98df7
commit a9592d835f

View File

@ -14,6 +14,8 @@ impl Bag {
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self> {
let bag_file = File::open(path).wrap_err("could not open bag file")?;
let mut reader = MmapReader::map(bag_file).wrap_err("could not map bag file memory")?;
// TODO: support unindexed bags
let index = BagIndex::read(&mut reader).wrap_err("error reading bag index")?;
Ok(Bag { reader, index })
}