pub struct TableStorage<'a, 'txn, T: KVTransaction<'txn>> { /* private fields */ }Expand description
TableStorage provides CRUD and scan operations over a table backed by a KV store.
The two lifetime parameters serve distinct purposes:
'a: The borrow duration of the transaction reference'txn: The lifetime parameter of the KVTransaction type itself
This separation is necessary to allow SqlTransaction to return TableStorage instances while maintaining proper lifetime relationships with GATs.
Implementations§
Source§impl<'a, 'txn, T: KVTransaction<'txn>> TableStorage<'a, 'txn, T>
impl<'a, 'txn, T: KVTransaction<'txn>> TableStorage<'a, 'txn, T>
Sourcepub fn new(txn: &'a mut T, table_meta: &TableMetadata) -> Self
pub fn new(txn: &'a mut T, table_meta: &TableMetadata) -> Self
Create a new TableStorage wrapper for a given table.
The table_id is obtained from table_meta.table_id.
Sourcepub fn insert(&mut self, row_id: u64, row: &[SqlValue]) -> Result<()>
pub fn insert(&mut self, row_id: u64, row: &[SqlValue]) -> Result<()>
Insert a row by RowID, enforcing primary key and NOT NULL constraints.
Sourcepub fn update(&mut self, row_id: u64, row: &[SqlValue]) -> Result<()>
pub fn update(&mut self, row_id: u64, row: &[SqlValue]) -> Result<()>
Update an existing row by RowID.
Sourcepub fn scan(&mut self) -> Result<TableScanIterator<'_>>
pub fn scan(&mut self) -> Result<TableScanIterator<'_>>
Scan all rows in the table.
Sourcepub fn range_scan(
&mut self,
start_row_id: u64,
end_row_id: u64,
) -> Result<TableScanIterator<'_>>
pub fn range_scan( &mut self, start_row_id: u64, end_row_id: u64, ) -> Result<TableScanIterator<'_>>
Scan rows in the half-open RowID range [start_row_id, end_row_id].
Sourcepub fn next_row_id(&mut self) -> Result<u64>
pub fn next_row_id(&mut self) -> Result<u64>
Get the next auto-increment RowID, incrementing the stored sequence.
Auto Trait Implementations§
impl<'a, 'txn, T> Freeze for TableStorage<'a, 'txn, T>
impl<'a, 'txn, T> RefUnwindSafe for TableStorage<'a, 'txn, T>where
T: RefUnwindSafe,
impl<'a, 'txn, T> Send for TableStorage<'a, 'txn, T>where
T: Send,
impl<'a, 'txn, T> Sync for TableStorage<'a, 'txn, T>where
T: Sync,
impl<'a, 'txn, T> Unpin for TableStorage<'a, 'txn, T>
impl<'a, 'txn, T> !UnwindSafe for TableStorage<'a, 'txn, T>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more