Table

Trait Table 

Source
pub trait Table:
    Any
    + Send
    + Sync {
Show 22 methods // Required methods fn dyn_clone(&self) -> Box<dyn Table>; fn as_any(&self) -> &dyn Any; fn spec(&self) -> TableSpec; fn clear(&mut self); fn all(&self) -> Subset; fn len(&self) -> usize; fn version(&self) -> TableVersion; fn updates_since(&self, offset: Offset) -> Subset; fn scan_generic_bounded( &self, subset: SubsetRef<'_>, start: Offset, n: usize, cs: &[Constraint], f: impl FnMut(RowId, &[Value]), ) -> Option<Offset> where Self: Sized; fn get_row(&self, key: &[Value]) -> Option<Row>; fn merge(&mut self, exec_state: &mut ExecutionState<'_>) -> TableChange; fn new_buffer(&self) -> Box<dyn MutationBuffer>; // Provided methods fn rebuilder<'a>( &'a self, _cols: &[ColumnId], ) -> Option<Box<dyn Rebuilder + 'a>> { ... } fn apply_rebuild( &mut self, _table_id: TableId, _table: &WrappedTable, _next_ts: Value, _exec_state: &mut ExecutionState<'_>, ) { ... } fn is_empty(&self) -> bool { ... } fn scan_generic( &self, subset: SubsetRef<'_>, f: impl FnMut(RowId, &[Value]), ) where Self: Sized { ... } fn refine_live(&self, subset: Subset) -> Subset { ... } fn refine_one(&self, subset: Subset, c: &Constraint) -> Subset { ... } fn refine(&self, subset: Subset, cs: &[Constraint]) -> Subset { ... } fn fast_subset(&self, _: &Constraint) -> Option<Subset> { ... } fn split_fast_slow( &self, cs: &[Constraint], ) -> (Subset, Pooled<Vec<Constraint>>, Pooled<Vec<Constraint>>) { ... } fn get_row_column(&self, key: &[Value], col: ColumnId) -> Option<Value> { ... }
}
Expand description

An interface for a table.

Required Methods§

Source

fn dyn_clone(&self) -> Box<dyn Table>

A variant of clone that returns a boxed trait object; this trait object must contain all of the data associated with the current table.

Source

fn as_any(&self) -> &dyn Any

A boilerplate method to make it easier to downcast values of Table.

Implementors should be able to implement this method by returning self.

Source

fn spec(&self) -> TableSpec

The schema of the table.

These are immutable properties of the table; callers can assume they will never change.

Source

fn clear(&mut self)

Clear all table contents. If the table is nonempty, this will change the generation of the table. This method also clears any pending data.

Source

fn all(&self) -> Subset

Get a subset corresponding to all rows in the table.

Source

fn len(&self) -> usize

Get the length of the table.

This is not in general equal to the length of the all subset: the size of a subset is allowed to be larger than the number of table entries in range of the subset.

Source

fn version(&self) -> TableVersion

Get the current version for the table. RowIds and Subsets are only valid for a given major generation.

Source

fn updates_since(&self, offset: Offset) -> Subset

Get the subset of the table that has appeared since the last offset.

Source

fn scan_generic_bounded( &self, subset: SubsetRef<'_>, start: Offset, n: usize, cs: &[Constraint], f: impl FnMut(RowId, &[Value]), ) -> Option<Offset>
where Self: Sized,

Iterate over the given subset of the table, starting at an opaque start token, ending after up to n rows, returning the next start token if more rows remain. Only invoke f on rows that match the given constraints.

This method is not object safe, but it is used to define various “default” implementations of object-safe methods like scan and pivot.

Source

fn get_row(&self, key: &[Value]) -> Option<Row>

Look up a single row by the given key values, if it is in the table.

The number of values specified by keys should match the number of primary keys for the table.

Source

fn merge(&mut self, exec_state: &mut ExecutionState<'_>) -> TableChange

Merge any updates to the table, and potentially update the generation for the table.

Source

fn new_buffer(&self) -> Box<dyn MutationBuffer>

Create a new buffer for staging mutations on this table.

Provided Methods§

Source

fn rebuilder<'a>( &'a self, _cols: &[ColumnId], ) -> Option<Box<dyn Rebuilder + 'a>>

If this table can perform a table-level rebuild, construct a Rebuilder for it.

Source

fn apply_rebuild( &mut self, _table_id: TableId, _table: &WrappedTable, _next_ts: Value, _exec_state: &mut ExecutionState<'_>, )

Rebuild the table according to the given Rebuilder implemented by table, if there is one. Applying a rebuild can cause more mutations to be buffered, which can in turn be flushed by a call to Table::merge.

Note that value-level rebuilds are only relevant for tables that opt into it. As a result, tables do nothing by default.

Source

fn is_empty(&self) -> bool

Check if the table is empty.

Source

fn scan_generic(&self, subset: SubsetRef<'_>, f: impl FnMut(RowId, &[Value]))
where Self: Sized,

Iterate over the given subset of the table.

This is a variant of Table::scan_generic_bounded that iterates over the entire table.

Source

fn refine_live(&self, subset: Subset) -> Subset

Filter a given subset of the table for the rows that are live

Source

fn refine_one(&self, subset: Subset, c: &Constraint) -> Subset

Filter a given subset of the table for the rows matching the single constraint.

Implementors must provide at least one of refine_one or refine.`

Source

fn refine(&self, subset: Subset, cs: &[Constraint]) -> Subset

Filter a given subset of the table for the rows matching the given constraints.

Implementors must provide at least one of refine_one or refine.`

Source

fn fast_subset(&self, _: &Constraint) -> Option<Subset>

An optional method for quickly generating a subset from a constraint. The standard use-case here is to apply constraints based on a column that is known to be sorted.

These constraints are very helpful for query planning; it is a good idea to implement them.

Source

fn split_fast_slow( &self, cs: &[Constraint], ) -> (Subset, Pooled<Vec<Constraint>>, Pooled<Vec<Constraint>>)

A helper routine that leverages the existing fast_subset method to preprocess a set of constraints into “fast” and “slow” ones, returning the subet of indexes that match the fast one.

Source

fn get_row_column(&self, key: &[Value], col: ColumnId) -> Option<Value>

Look up the given column of single row by the given key values, if it is in the table.

The number of values specified by keys should match the number of primary keys for the table.

Implementors§