Skip to content

Commit 4d0575d

Browse files
committed
aumap: add to_dump method
1 parent fe89f25 commit 4d0575d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/providers/file/aumap.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ where
161161
}
162162

163163
pub fn path(&self) -> &Path { &self.path }
164+
165+
pub fn to_dump(&self) -> FileAuraMapDump<KEY_LEN, VAL_LEN> {
166+
FileAuraMapDump {
167+
on_disk: self.on_disk.clone(),
168+
dirty: self.dirty.clone(),
169+
pending: self.pending.clone(),
170+
}
171+
}
164172
}
165173

166174
impl<K, V, const MAGIC: u64, const VER: u16, const KEY_LEN: usize, const VAL_LEN: usize>
@@ -244,6 +252,13 @@ where
244252
}
245253
}
246254

255+
#[derive(Clone, Eq, PartialEq, Debug)]
256+
pub struct FileAuraMapDump<const KEY_LEN: usize, const VAL_LEN: usize> {
257+
pub on_disk: Vec<IndexMap<[u8; KEY_LEN], [u8; VAL_LEN]>>,
258+
pub dirty: Vec<IndexMap<[u8; KEY_LEN], [u8; VAL_LEN]>>,
259+
pub pending: IndexMap<[u8; KEY_LEN], [u8; VAL_LEN]>,
260+
}
261+
247262
#[cfg(test)]
248263
mod tests {
249264
use std::collections::HashSet;

src/providers/file/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ mod aumap;
55
mod index;
66

77
pub use aomap::FileAoraMap;
8-
pub use aumap::FileAuraMap;
8+
pub use aumap::{FileAuraMap, FileAuraMapDump};
99
pub use index::FileAoraIndex;

0 commit comments

Comments
 (0)