Skip to content

Commit

Permalink
DiskTree → DiskTreeMap
Browse files Browse the repository at this point in the history
  • Loading branch information
JayKickliter committed Jan 5, 2024
1 parent 46719a0 commit 8f33bc6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use h3o::{
CellIndex, Resolution,
};
use h3ron::H3Cell;
use hextree::{compaction::EqCompactor, disktree::DiskTree, Cell, HexTreeMap, HexTreeSet};
use hextree::{compaction::EqCompactor, disktree::DiskTreeMap, Cell, HexTreeMap, HexTreeSet};
use std::convert::TryFrom;

fn set_lookup(c: &mut Criterion) {
Expand Down Expand Up @@ -60,7 +60,7 @@ fn disk_set_lookup(c: &mut Criterion) {
us915_set
.to_disktree(&mut file, |_, _| Ok::<(), std::io::Error>(()))
.unwrap();
DiskTree::memmap(file).unwrap()
DiskTreeMap::memmap(file).unwrap()
};

let tarpon_springs = coord! {x: -82.753822, y: 28.15215};
Expand Down
10 changes: 5 additions & 5 deletions src/disktree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#[cfg(not(target_pointer_width = "64"))]
compile_warning!("disktree may silently fail on non-64bit systems");

pub use tree::DiskTree;
pub use tree::DiskTreeMap;

mod dptr;
mod iter;
Expand Down Expand Up @@ -54,7 +54,7 @@ mod tests {
monaco
.to_disktree(&mut file, |wtr, val| bincode::serialize_into(wtr, val))
.unwrap();
let monaco_disktree = DiskTree::open(path).unwrap();
let monaco_disktree = DiskTreeMap::open(path).unwrap();

assert_eq!(monaco.get(point_2).unzip().1, None);
assert_eq!(monaco.get(point_1).unzip().1, Some(&Region::Monaco));
Expand Down Expand Up @@ -126,14 +126,14 @@ mod tests {
map
};

let monaco_disktree: DiskTree<_> = {
let monaco_disktree: DiskTreeMap<_> = {
let file = tempfile::NamedTempFile::new().unwrap();
let (mut file, path) = file.keep().unwrap();
monaco_hextree
.to_disktree(&mut file, |wtr, val| wtr.write_all(val))
.unwrap();
let _ = file;
DiskTree::open(path).unwrap()
DiskTreeMap::open(path).unwrap()
};

// Assert neither hashmap nor disktree contain reserved cells.
Expand Down Expand Up @@ -187,7 +187,7 @@ mod tests {
monaco
.to_disktree(&mut file, |wtr, val| bincode::serialize_into(wtr, val))
.unwrap();
let monaco_disktree = DiskTree::open(path).unwrap();
let monaco_disktree = DiskTreeMap::open(path).unwrap();

// Create the iterator with the user-defined deserialzer.
let disktree_iter = monaco_disktree.iter().unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/disktree/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pub(crate) const HDR_MAGIC: &[u8] = b"hextree\0";
pub(crate) const HDR_SZ: u64 = HDR_MAGIC.len() as u64 + 1;

/// An on-disk hextree map.
pub struct DiskTree<B>(B);
pub struct DiskTreeMap<B>(B);

impl DiskTree<Mmap> {
impl DiskTreeMap<Mmap> {
/// Opens a `DiskTree` at the specified path.
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self> {
let file = File::open(path)?;
Expand All @@ -34,7 +34,7 @@ impl DiskTree<Mmap> {
}
}

impl<B: AsRef<[u8]>> DiskTree<B> {
impl<B: AsRef<[u8]>> DiskTreeMap<B> {
/// Opens a `DiskTree` with a provided buffer.
pub fn with_buf(buf: B) -> Result<Self> {
let mut csr = Cursor::new(buf);
Expand Down

0 comments on commit 8f33bc6

Please sign in to comment.