Skip to content

Commit

Permalink
chore: clean up warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier authored and pepyakin committed Aug 24, 2024
1 parent 21a9512 commit 14cac90
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 39 deletions.
1 change: 0 additions & 1 deletion nomt/src/beatree/allocator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::{
io::{IoCommand, IoHandle, IoKind},
io::{Page, PAGE_SIZE},
};
use crossbeam_channel::TrySendError;

use std::{
fs::File,
Expand Down
2 changes: 1 addition & 1 deletion nomt/src/beatree/branch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions nomt/src/beatree/branch/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -89,10 +85,6 @@ impl BranchNode {
slice[7] = len;
}

fn varbits(&self) -> &BitSlice<u8, Msb0> {
self.view().varbits()
}

fn varbits_mut(&mut self) -> &mut BitSlice<u8, Msb0> {
let body_end = body_size(
self.prefix_len() as _,
Expand Down Expand Up @@ -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())
}
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions nomt/src/beatree/leaf/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion nomt/src/beatree/ops/update/leaf.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bitvec::prelude::*;
use std::{cmp::Ordering, io::Read};
use std::cmp::Ordering;

use crate::beatree::{
allocator::PageNumber,
Expand Down
6 changes: 1 addition & 5 deletions nomt/src/bitbox/meta_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ impl MetaMap {
}
}

#[allow(unused)]
pub fn full_count(&self) -> usize {
self.bitvec
.iter()
Expand All @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion nomt/src/bitbox/wal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::{
fs::File,
io::{Read, Write},
os::fd::AsRawFd,
path::PathBuf,
};

mod batch;
Expand Down
5 changes: 0 additions & 5 deletions nomt/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,4 @@ impl IoHandle {
pub fn try_recv(&self) -> Result<CompleteIo, TryRecvError> {
self.completion_receiver.try_recv()
}

/// Get the underlying completion receiver for raw access.
pub fn receiver(&self) -> &Receiver<CompleteIo> {
&self.completion_receiver
}
}
4 changes: 2 additions & 2 deletions nomt/src/page_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ use crate::{
Options,
};
use bitvec::prelude::*;
use fxhash::{FxBuildHasher, FxHashMap};
use fxhash::FxBuildHasher;
use lru::LruCache;
use nomt_core::{
page::DEPTH,
page_id::{ChildPageIndex, PageId, NUM_CHILDREN, ROOT_PAGE_ID},
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`
Expand Down
4 changes: 3 additions & 1 deletion nomt/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -43,6 +43,8 @@ struct Shared {
ln_fd: File,
bbn_fd: File,
ht_fd: File,
// keep alive.
#[allow(unused)]
wal_fd: File,
}

Expand Down

0 comments on commit 14cac90

Please sign in to comment.