Skip to main content

RowStore

Struct RowStore 

Source
pub struct RowStore { /* private fields */ }
Expand description

Row storage for a single table.

Implementations§

Source§

impl RowStore

Source

pub fn new(schema: Table) -> Self

Creates a new row store for the given table schema.

Source

pub fn schema(&self) -> &Table

Returns the table schema.

Source

pub fn len(&self) -> usize

Returns the number of rows.

Source

pub fn is_empty(&self) -> bool

Returns true if the store is empty.

Source

pub fn insert(&mut self, row: Row) -> Result<RowId>

Inserts a row into the store.

Source

pub fn update(&mut self, row_id: RowId, new_row: Row) -> Result<()>

Updates a row in the store.

Source

pub fn delete(&mut self, row_id: RowId) -> Result<Rc<Row>>

Deletes a row from the store.

Source

pub fn get(&self, row_id: RowId) -> Option<Rc<Row>>

Gets a row by ID.

Source

pub fn get_mut(&mut self, row_id: RowId) -> Option<&mut Row>

Gets a mutable reference to a row by ID (requires exclusive access). Note: This clones the Rc and returns a new Row if mutation is needed.

Source

pub fn scan(&self) -> impl Iterator<Item = Rc<Row>> + '_

Returns an iterator over all rows.

Source

pub fn row_ids(&self) -> Vec<RowId>

Returns all row IDs.

Source

pub fn get_by_pk(&self, pk_value: &Value) -> Vec<Rc<Row>>

Gets rows by primary key value.

Source

pub fn find_row_id_by_pk(&self, row: &Row) -> Option<RowId>

Finds existing row ID by primary key.

Source

pub fn pk_exists(&self, pk_value: &Value) -> bool

Checks if a primary key value exists.

Source

pub fn index_scan( &self, index_name: &str, range: Option<&KeyRange<Value>>, ) -> Vec<Rc<Row>>

Gets rows by index scan.

Source

pub fn index_scan_with_limit( &self, index_name: &str, range: Option<&KeyRange<Value>>, limit: Option<usize>, ) -> Vec<Rc<Row>>

Gets rows by index scan with limit.

Source

pub fn index_scan_with_limit_offset( &self, index_name: &str, range: Option<&KeyRange<Value>>, limit: Option<usize>, offset: usize, ) -> Vec<Rc<Row>>

Gets rows by index scan with limit and offset. This enables true pushdown of LIMIT/OFFSET to the storage layer.

Source

pub fn index_scan_with_options( &self, index_name: &str, range: Option<&KeyRange<Value>>, limit: Option<usize>, offset: usize, reverse: bool, ) -> Vec<Rc<Row>>

Gets rows by index scan with limit, offset, and reverse option. This enables true pushdown of LIMIT/OFFSET/ORDER to the storage layer.

Source

pub fn clear(&mut self)

Clears all rows and indices.

Source

pub fn get_many(&self, row_ids: &[RowId]) -> Vec<Option<Rc<Row>>>

Gets multiple rows by IDs.

Source

pub fn insert_or_replace(&mut self, row: Row) -> Result<(RowId, bool)>

Inserts a row or replaces an existing row with the same primary key. Returns the row ID and whether it was a replacement.

Source

pub fn secondary_index_contains(&self, index_name: &str, key: &Value) -> bool

Checks if a secondary index contains a key (for unique constraint checking).

Source

pub fn pk_columns(&self) -> &[usize]

Gets the primary key columns indices.

Source

pub fn extract_pk(&self, row: &Row) -> Option<Value>

Extracts the primary key value from a row.

Source

pub fn insert_with_delta(&mut self, row: Row) -> Result<Delta<Row>>

Inserts a row and returns a Delta for IVM propagation.

Source

pub fn delete_with_delta(&mut self, row_id: RowId) -> Result<Delta<Row>>

Deletes a row and returns a Delta for IVM propagation.

Source

pub fn update_with_delta( &mut self, row_id: RowId, new_row: Row, ) -> Result<(Delta<Row>, Delta<Row>)>

Updates a row and returns Deltas for IVM propagation (delete old + insert new).

Source

pub fn gin_index_get_by_key_value( &self, index_name: &str, key: &str, value: &str, ) -> Vec<Rc<Row>>

Queries the GIN index by key-value pair.

Source

pub fn gin_index_get_by_key(&self, index_name: &str, key: &str) -> Vec<Rc<Row>>

Queries the GIN index by key existence.

Source

pub fn gin_index_get_by_key_values_all( &self, index_name: &str, pairs: &[(&str, &str)], ) -> Vec<Rc<Row>>

Queries the GIN index by multiple key-value pairs (AND query). Returns rows that match ALL of the given key-value pairs.

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.