Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Jul 26, 2024
1 parent 8c61555 commit 0836931
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub use {
handle::ValueHandle,
index::{Reader as IndexReader, Writer as IndexWriter},
segment::multi_writer::MultiWriter as SegmentWriter,
value::UserValue,
value::{UserKey, UserValue},
value_log::ValueLog,
version::Version,
};
Expand Down
4 changes: 2 additions & 2 deletions src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::{IndexReader, IndexWriter, ValueHandle};
use crate::{value::UserKey, IndexReader, IndexWriter, ValueHandle};
use std::{
collections::BTreeMap,
sync::{Arc, RwLock},
};

type MockIndexInner = RwLock<BTreeMap<Arc<[u8]>, (ValueHandle, u32)>>;
type MockIndexInner = RwLock<BTreeMap<UserKey, (ValueHandle, u32)>>;

/// Mock in-memory index
#[allow(clippy::module_name_repetitions)]
Expand Down
8 changes: 4 additions & 4 deletions src/segment/merge.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{id::SegmentId, SegmentReader};
use crate::{id::SegmentId, value::UserKey, SegmentReader, UserValue};
use std::{cmp::Reverse, sync::Arc};

// TODO: replace with MinHeap...
Expand All @@ -9,8 +9,8 @@ type IteratorIndex = usize;
#[derive(Debug)]
struct IteratorValue {
index: IteratorIndex,
key: Arc<[u8]>,
value: Arc<[u8]>,
key: UserKey,
value: UserValue,
segment_id: SegmentId,
crc: u32,
}
Expand Down Expand Up @@ -79,7 +79,7 @@ impl MergeReader {
}

impl Iterator for MergeReader {
type Item = crate::Result<(Arc<[u8]>, Arc<[u8]>, SegmentId, u32)>;
type Item = crate::Result<(UserKey, UserValue, SegmentId, u32)>;

fn next(&mut self) -> Option<Self::Item> {
if self.heap.is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions src/segment/reader.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{meta::METADATA_HEADER_MAGIC, writer::BLOB_HEADER_MAGIC};
use crate::{id::SegmentId, Compressor};
use crate::{id::SegmentId, value::UserKey, Compressor, UserValue};
use byteorder::{BigEndian, ReadBytesExt};
use std::{
fs::File,
Expand Down Expand Up @@ -50,7 +50,7 @@ impl Reader {
}

impl Iterator for Reader {
type Item = crate::Result<(Arc<[u8]>, Arc<[u8]>, u32)>;
type Item = crate::Result<(UserKey, UserValue, u32)>;

fn next(&mut self) -> Option<Self::Item> {
if self.is_terminated {
Expand Down
2 changes: 1 addition & 1 deletion src/value_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ impl ValueLog {
/// # Errors
///
/// Will return `Err` if an IO error occurs.
#[allow(clippy::result_unit_err)]
#[allow(clippy::result_uAnit_err)]
pub fn scan_for_stats(
&self,
iter: impl Iterator<Item = std::io::Result<(ValueHandle, u32)>>,
Expand Down

0 comments on commit 0836931

Please sign in to comment.