Reorder removal so that mmap is removed before storage

This commit is contained in:
Igor Katson 2024-09-13 00:20:37 +01:00
parent 816838cdf0
commit 00daae97ed
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
2 changed files with 15 additions and 8 deletions

View file

@ -8,6 +8,7 @@ use bitvec::{
vec::BitVec,
view::{AsBits, AsMutBits},
};
use tracing::trace;
pub trait BitV: Send + Sync {
fn as_slice(&self) -> &BitSlice<u8, Msb0>;
@ -24,6 +25,12 @@ pub struct MmapBitV {
mmap: memmap2::MmapMut,
}
impl Drop for MmapBitV {
fn drop(&mut self) {
trace!("dropping MmapBitV, this should unmap the .bitv file")
}
}
impl MmapBitV {
pub fn new(file: File) -> anyhow::Result<Self> {
let mmap =