diff --git a/nomt/src/beatree/allocator/mod.rs b/nomt/src/beatree/allocator/mod.rs index 4f92ad4a..8d07fbf8 100644 --- a/nomt/src/beatree/allocator/mod.rs +++ b/nomt/src/beatree/allocator/mod.rs @@ -2,7 +2,6 @@ use crate::{ io::{IoCommand, IoHandle, IoKind}, io::{Page, PAGE_SIZE}, }; -use crossbeam_channel::TrySendError; use std::{ fs::File, diff --git a/nomt/src/beatree/branch/mod.rs b/nomt/src/beatree/branch/mod.rs index 6bc9b9e3..bf953fd3 100644 --- a/nomt/src/beatree/branch/mod.rs +++ b/nomt/src/beatree/branch/mod.rs @@ -12,7 +12,7 @@ use std::{ }; pub use node::{ - body_fullness, body_size, BranchNode, BranchNodeBuilder, BranchNodeView, BRANCH_NODE_BODY_SIZE, + body_size, BranchNode, BranchNodeBuilder, BranchNodeView, BRANCH_NODE_BODY_SIZE, }; pub mod node; diff --git a/nomt/src/beatree/branch/node.rs b/nomt/src/beatree/branch/node.rs index 93b892f1..f8f9350f 100644 --- a/nomt/src/beatree/branch/node.rs +++ b/nomt/src/beatree/branch/node.rs @@ -58,10 +58,6 @@ impl BranchNode { slice[0..4].copy_from_slice(&pn.to_le_bytes()); } - pub fn is_bbn(&self) -> bool { - self.view().is_bbn() - } - pub fn n(&self) -> u16 { self.view().n() } @@ -89,10 +85,6 @@ impl BranchNode { slice[7] = len; } - fn varbits(&self) -> &BitSlice { - self.view().varbits() - } - fn varbits_mut(&mut self) -> &mut BitSlice { let body_end = body_size( self.prefix_len() as _, @@ -152,10 +144,6 @@ impl<'a> BranchNodeView<'a> { u32::from_le_bytes(self.inner[0..4].try_into().unwrap()) } - pub fn is_bbn(&self) -> bool { - self.bbn_pn() == 0 - } - pub fn n(&self) -> u16 { u16::from_le_bytes(self.inner[4..6].try_into().unwrap()) } @@ -200,10 +188,6 @@ pub fn body_size(prefix_len: usize, separator_len: usize, n: usize) -> usize { (prefix_len + (separator_len * n) + 7) / 8 + (4 * n) } -pub fn body_fullness(prefix_len: usize, separator_len: usize, n: usize) -> f32 { - body_size(prefix_len, separator_len, n) as f32 / BRANCH_NODE_BODY_SIZE as f32 -} - pub struct BranchNodeBuilder { branch: BranchNode, index: usize, diff --git a/nomt/src/beatree/leaf/node.rs b/nomt/src/beatree/leaf/node.rs index 8a9b2647..ea9d959a 100644 --- a/nomt/src/beatree/leaf/node.rs +++ b/nomt/src/beatree/leaf/node.rs @@ -37,12 +37,6 @@ pub struct LeafNode { } impl LeafNode { - pub fn zeroed() -> Self { - LeafNode { - inner: Box::new(Page::zeroed()), - } - } - pub fn n(&self) -> usize { u16::from_le_bytes(self.inner[0..2].try_into().unwrap()) as usize } diff --git a/nomt/src/beatree/ops/update/leaf.rs b/nomt/src/beatree/ops/update/leaf.rs index 9a1b4a3c..5edd4d9d 100644 --- a/nomt/src/beatree/ops/update/leaf.rs +++ b/nomt/src/beatree/ops/update/leaf.rs @@ -1,5 +1,5 @@ use bitvec::prelude::*; -use std::{cmp::Ordering, io::Read}; +use std::cmp::Ordering; use crate::beatree::{ allocator::PageNumber, diff --git a/nomt/src/bitbox/meta_map.rs b/nomt/src/bitbox/meta_map.rs index 7ead27d3..3990051e 100644 --- a/nomt/src/bitbox/meta_map.rs +++ b/nomt/src/bitbox/meta_map.rs @@ -23,6 +23,7 @@ impl MetaMap { } } + #[allow(unused)] pub fn full_count(&self) -> usize { self.bitvec .iter() @@ -38,11 +39,6 @@ impl MetaMap { self.bitvec[bucket] = full_entry(hash); } - pub fn set_empty(&mut self, bucket: usize) { - self.bitvec[bucket] = EMPTY; - } - - #[allow(unused)] pub fn set_tombstone(&mut self, bucket: usize) { self.bitvec[bucket] = TOMBSTONE; } diff --git a/nomt/src/bitbox/wal/mod.rs b/nomt/src/bitbox/wal/mod.rs index 9c55ed0b..69f97f28 100644 --- a/nomt/src/bitbox/wal/mod.rs +++ b/nomt/src/bitbox/wal/mod.rs @@ -2,7 +2,6 @@ use std::{ fs::File, io::{Read, Write}, os::fd::AsRawFd, - path::PathBuf, }; mod batch; diff --git a/nomt/src/io/mod.rs b/nomt/src/io/mod.rs index 48d47269..5bfc7334 100644 --- a/nomt/src/io/mod.rs +++ b/nomt/src/io/mod.rs @@ -173,9 +173,4 @@ impl IoHandle { pub fn try_recv(&self) -> Result { self.completion_receiver.try_recv() } - - /// Get the underlying completion receiver for raw access. - pub fn receiver(&self) -> &Receiver { - &self.completion_receiver - } } diff --git a/nomt/src/page_cache.rs b/nomt/src/page_cache.rs index ccd21429..4dd2ad2d 100644 --- a/nomt/src/page_cache.rs +++ b/nomt/src/page_cache.rs @@ -7,7 +7,7 @@ use crate::{ Options, }; use bitvec::prelude::*; -use fxhash::{FxBuildHasher, FxHashMap}; +use fxhash::FxBuildHasher; use lru::LruCache; use nomt_core::{ page::DEPTH, @@ -15,7 +15,7 @@ use nomt_core::{ trie::{LeafData, Node}, trie_pos::{ChildNodeIndices, TriePosition}, }; -use parking_lot::{Condvar, Mutex, RwLock}; +use parking_lot::{Mutex, RwLock}; use std::{fmt, num::NonZeroUsize, sync::Arc}; // Total number of nodes stored in one Page. It depends on the `DEPTH` diff --git a/nomt/src/store/mod.rs b/nomt/src/store/mod.rs index c893f679..94a0186d 100644 --- a/nomt/src/store/mod.rs +++ b/nomt/src/store/mod.rs @@ -8,7 +8,7 @@ use crate::{ use meta::Meta; use nomt_core::{ page_id::PageId, - trie::{KeyPath, Node, TERMINATOR}, + trie::KeyPath, }; use parking_lot::Mutex; use std::{ @@ -43,6 +43,8 @@ struct Shared { ln_fd: File, bbn_fd: File, ht_fd: File, + // keep alive. + #[allow(unused)] wal_fd: File, }