Skip to main content

MemTable

Struct MemTable 

Source
pub struct MemTable {
    pub num_columns: usize,
    /* private fields */
}

Fields§

§num_columns: usize

Column count for this table (used when creating the table; actual row widths may vary).

Implementations§

Source§

impl MemTable

Source

pub fn set_collation_registry( &mut self, registry: Arc<Mutex<CollationRegistry>>, )

Source

pub fn add_unique_column_group(&mut self, cols: Vec<usize>)

Register a group of columns that together form a UNIQUE constraint.

Source

pub fn add_unique_column_group_with_collations( &mut self, cols: Vec<usize>, collations: Vec<Option<String>>, )

Register a group of columns that together form a UNIQUE constraint with explicit per-column collation metadata.

Source

pub fn remove_unique_column_group_with_collations( &mut self, cols: &[usize], collations: &[Option<String>], ) -> bool

Remove one matching UNIQUE constraint from the in-memory table.

TEMP indexes are represented by direct MemTable constraints rather than a separate B-tree, so DROP INDEX uses this to retire exactly the enforcement rule that CREATE UNIQUE INDEX installed.

Source

pub fn unique_column_group_is_valid( &self, cols: &[usize], collations: &[Option<String>], ) -> bool

Return whether the current rows satisfy a proposed UNIQUE constraint.

This is used by TEMP CREATE UNIQUE INDEX before mutating schema metadata. Builtin collations use the same canonical key encoding as the installed constraint; custom collations use the exact comparison path.

Source

pub fn find_unique_conflicts(&self, new_values: &[SqliteValue]) -> Vec<i64>

Find rows that conflict with new_values on any UNIQUE constraint. Returns the rowids of all conflicting rows.

Source

pub fn alloc_rowid(&mut self) -> i64

Allocate a new unique rowid.

Source

pub fn next_rowid_hint(&self) -> i64

Return the next implicit rowid that would be allocated for this table.

Source

pub fn row_count(&self) -> usize

Return the exact visible row count.

Source

pub fn max_visible_rowid(&self) -> Option<i64>

Return the maximum currently visible rowid.

Source

pub fn delete_by_rowid(&mut self, rowid: i64) -> bool

Delete a row by rowid. Returns true if a row was found and deleted.

Source

pub fn clear(&mut self)

Remove all rows from the table.

Source

pub fn pad_rows_to_column_count( &mut self, target_cols: usize, default_val: &SqliteValue, )

Pad all existing rows to have at least target_cols columns, appending default_val for any missing trailing columns. Used after ALTER TABLE ADD COLUMN to make pre-existing rows visible with the new column’s default value.

Source

pub fn find_by_rowid(&self, rowid: i64) -> Option<usize>

Find a row by rowid. Returns the index.

Source

pub fn row_values_by_rowid(&self, rowid: i64) -> Option<&[SqliteValue]>

Return the values for a rowid, if present.

Source

pub fn count_rowid_range( &self, lower_inclusive: i64, upper_exclusive: i64, ) -> usize

Count rows whose rowid is in [lower_inclusive, upper_exclusive).

Source

pub fn iter_rows_in_rowid_range( &self, lower_inclusive: i64, upper_exclusive: i64, ) -> impl Iterator<Item = (i64, &[SqliteValue])> + '_

Iterate rows whose rowid is in [lower_inclusive, upper_exclusive).

Source

pub fn iter_rows(&self) -> impl Iterator<Item = (i64, &[SqliteValue])> + '_

Iterate all rows as (rowid, values) pairs.

Used by the compat persistence layer to dump table contents to real SQLite format files.

Source

pub fn insert_row<V>(&mut self, rowid: i64, values: V)
where V: Into<MemRowValues>,

Insert a row with an explicit rowid (for loading from file).

This is the public entry point used by the compat persistence loader. It delegates to the private insert method.

Trait Implementations§

Source§

impl Clone for MemTable

Source§

fn clone(&self) -> MemTable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MemTable

Source§

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

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more