pub struct StaticSortedFile { /* private fields */ }Expand description
A memory mapped SST file.
Implementations§
Source§impl StaticSortedFile
impl StaticSortedFile
Sourcepub fn open(db_path: &Path, meta: StaticSortedFileMetaData) -> Result<Self>
pub fn open(db_path: &Path, meta: StaticSortedFileMetaData) -> Result<Self>
Opens an SST file at the given path. This memory maps the file, but does not read it yet. It’s lazy read on demand.
Sourcepub fn open_for_compaction(
db_path: &Path,
meta: StaticSortedFileMetaData,
) -> Result<Self>
pub fn open_for_compaction( db_path: &Path, meta: StaticSortedFileMetaData, ) -> Result<Self>
Opens an SST file for compaction. Uses MADV_SEQUENTIAL instead of MADV_RANDOM, since compaction reads blocks sequentially and benefits from OS read-ahead and page reclamation.
Sourcepub fn try_into_iter(self) -> Result<StaticSortedFileIter>
pub fn try_into_iter(self) -> Result<StaticSortedFileIter>
Consume this file and return an iterator over all entries in sorted order. The iterator takes ownership of the SST file, so the mmap and its pages are freed when the iterator is dropped.
Sourcepub fn lookup<K: QueryKey, const FIND_ALL: bool>(
&self,
key_hash: u64,
key: &K,
key_block_cache: &BlockCache,
value_block_cache: &BlockCache,
) -> Result<SstLookupResult>
pub fn lookup<K: QueryKey, const FIND_ALL: bool>( &self, key_hash: u64, key: &K, key_block_cache: &BlockCache, value_block_cache: &BlockCache, ) -> Result<SstLookupResult>
Looks up a key in this file.
If FIND_ALL is false, returns after finding the first match.
If FIND_ALL is true, returns all entries with the same key (useful for
keyspaces where keys are hashes and collisions are possible).
Auto Trait Implementations§
impl Freeze for StaticSortedFile
impl RefUnwindSafe for StaticSortedFile
impl Send for StaticSortedFile
impl Sync for StaticSortedFile
impl Unpin for StaticSortedFile
impl UnsafeUnpin for StaticSortedFile
impl UnwindSafe for StaticSortedFile
Blanket Implementations§
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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