pub struct Segment(/* private fields */);
Expand description
Disk segment (a.k.a. SSTable
, SST
, sorted string table
) that is located on disk
A segment is an immutable list of key-value pairs, split into compressed blocks.
A reference to the block (block handle
) is saved in the “block index”.
Deleted entries are represented by tombstones.
Segments can be merged together to improve read performance and reduce disk space by removing outdated item versions.
Implementations§
Source§impl Segment
impl Segment
Sourcepub fn version_factor(&self) -> f32
pub fn version_factor(&self) -> f32
Calculates how many versions per key there are on average.
Sourcepub fn id(&self) -> SegmentId
pub fn id(&self) -> SegmentId
Gets the segment ID.
The segment ID is unique for this tree, but not
across multiple trees, use Segment::global_id
for that.
Sourcepub fn bloom_filter_size(&self) -> usize
pub fn bloom_filter_size(&self) -> usize
Gets the bloom filter size
pub fn get( &self, key: &[u8], seqno: Option<SeqNo>, hash: CompositeHash, ) -> Result<Option<InternalValue>>
pub fn is_key_in_key_range(&self, key: &[u8]) -> bool
Sourcepub fn get_highest_seqno(&self) -> SeqNo
pub fn get_highest_seqno(&self) -> SeqNo
Returns the highest sequence number in the segment.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Segment
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnwindSafe for Segment
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