Skip to main content

IndexStorage

Struct IndexStorage 

Source
pub struct IndexStorage {
    pub columns: Vec<(String, SortDirection)>,
    pub tree: BTreeMap<IndexKey, Vec<IndexEntry>>,
}
Expand description

Storage for one declared index: BTreeMap keyed by IndexKey (direction- wrapped per column) to a Vec of posting entries with MVCC visibility.

Fields§

§columns: Vec<(String, SortDirection)>§tree: BTreeMap<IndexKey, Vec<IndexEntry>>

Non-unique keys map to Vec; tie-break by row_id ascending is maintained at insert time (I18).

Implementations§

Source§

impl IndexStorage

Source

pub fn new(columns: Vec<(String, SortDirection)>) -> Self

Source

pub fn total_entries(&self) -> u64

Number of live (non-tombstoned) postings, useful for leak detection.

Source

pub fn total_entries_including_tombstones(&self) -> u64

Total postings including tombstones (for DROP TABLE leak detection).

Source

pub fn insert_posting(&mut self, key: IndexKey, entry: IndexEntry)

Insert a posting at the given key, placing it in row_id-ascending order.

Source

pub fn tombstone_posting( &mut self, key: &IndexKey, row_id: RowId, deleted_tx: TxId, )

Stamp deleted_tx on the posting matching row_id at key.

Trait Implementations§

Source§

impl Debug for IndexStorage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IndexStorage

Source§

fn default() -> IndexStorage

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.