pub struct LevelMetadata {
pub level: u32,
pub files: Vec<Arc<FileMetadata>>,
pub total_size: u64,
pub target_size: u64,
pub compaction_score: f64,
}Expand description
Metadata for a single level in the LSM tree
Fields§
§level: u32Level number (0 = unsorted, 1+ = sorted)
files: Vec<Arc<FileMetadata>>Files in this level (sorted by smallest_key for L1+)
total_size: u64Total size of files in this level
target_size: u64Target size for this level (for compaction decisions)
compaction_score: f64Compaction score (size / target_size)
Implementations§
Source§impl LevelMetadata
impl LevelMetadata
Sourcepub fn find_files_for_key(&self, key: &[u8]) -> Vec<&Arc<FileMetadata>>
pub fn find_files_for_key(&self, key: &[u8]) -> Vec<&Arc<FileMetadata>>
Find files that may contain a key using binary search (for L1+)
Sourcepub fn find_files_for_range(
&self,
start: &[u8],
end: &[u8],
) -> Vec<&Arc<FileMetadata>>
pub fn find_files_for_range( &self, start: &[u8], end: &[u8], ) -> Vec<&Arc<FileMetadata>>
Find files that overlap with a key range
Sourcepub fn update_compaction_score(&mut self)
pub fn update_compaction_score(&mut self)
Recalculate compaction score
Trait Implementations§
Source§impl Clone for LevelMetadata
impl Clone for LevelMetadata
Source§fn clone(&self) -> LevelMetadata
fn clone(&self) -> LevelMetadata
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LevelMetadata
impl RefUnwindSafe for LevelMetadata
impl Send for LevelMetadata
impl Sync for LevelMetadata
impl Unpin for LevelMetadata
impl UnsafeUnpin for LevelMetadata
impl UnwindSafe for LevelMetadata
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more