pub struct TableHeap {
pub schema: SchemaRef,
pub buffer_pool: Arc<BufferManager>,
pub first_page_id: AtomicPageId,
pub last_page_id: AtomicPageId,
}Fields§
§schema: SchemaRef§buffer_pool: Arc<BufferManager>§first_page_id: AtomicPageId§last_page_id: AtomicPageIdImplementations§
Source§impl TableHeap
impl TableHeap
Sourcepub fn try_new(
schema: SchemaRef,
buffer_pool: Arc<BufferManager>,
) -> QuillSQLResult<Self>
pub fn try_new( schema: SchemaRef, buffer_pool: Arc<BufferManager>, ) -> QuillSQLResult<Self>
Creates a new table heap. This involves allocating an initial page.
Sourcepub fn insert_tuple(
&self,
meta: &TupleMeta,
tuple: &Tuple,
) -> QuillSQLResult<RecordId>
pub fn insert_tuple( &self, meta: &TupleMeta, tuple: &Tuple, ) -> QuillSQLResult<RecordId>
Inserts a tuple into the table.
This function inserts the given tuple into the table. If the last page in the table has enough space for the tuple, it is inserted there. Otherwise, a new page is allocated and the tuple is inserted there.
Parameters:
meta: The metadata associated with the tuple.tuple: The tuple to be inserted.
Returns:
An Option containing the Rid of the inserted tuple if successful, otherwise None.
Inserts a tuple into the table.
Sourcepub fn mvcc_insert_version(
&self,
tuple: &Tuple,
txn_id: TransactionId,
cid: CommandId,
prev_version: Option<RecordId>,
) -> QuillSQLResult<(RecordId, TupleMeta)>
pub fn mvcc_insert_version( &self, tuple: &Tuple, txn_id: TransactionId, cid: CommandId, prev_version: Option<RecordId>, ) -> QuillSQLResult<(RecordId, TupleMeta)>
MVCC helper: insert a new tuple version with optional link to a previous version.
Sourcepub fn mvcc_update(
&self,
current_rid: RecordId,
new_tuple: Tuple,
txn_id: TransactionId,
cid: CommandId,
) -> QuillSQLResult<(RecordId, TupleMeta)>
pub fn mvcc_update( &self, current_rid: RecordId, new_tuple: Tuple, txn_id: TransactionId, cid: CommandId, ) -> QuillSQLResult<(RecordId, TupleMeta)>
Create a new tuple version for UPDATE while marking the source version deleted. Returns the RecordId of the new version and the original metadata (pre-change) for undo.
Sourcepub fn mvcc_mark_deleted(
&self,
rid: RecordId,
txn_id: TransactionId,
cid: CommandId,
) -> QuillSQLResult<TupleMeta>
pub fn mvcc_mark_deleted( &self, rid: RecordId, txn_id: TransactionId, cid: CommandId, ) -> QuillSQLResult<TupleMeta>
Mark a tuple version as deleted for MVCC-aware DELETE operations. Returns the previous metadata prior to marking deleted (for undo purposes).
Sourcepub fn mvcc_remove_version(&self, rid: RecordId) -> QuillSQLResult<()>
pub fn mvcc_remove_version(&self, rid: RecordId) -> QuillSQLResult<()>
Remove a heap version created by an aborted operation. For safety this currently expects the version to live at the tail of the page; otherwise it simply marks the slot deleted and leaves full reclamation to vacuum.
pub fn update_tuple(&self, rid: RecordId, tuple: Tuple) -> QuillSQLResult<()>
pub fn update_tuple_meta( &self, meta: TupleMeta, rid: RecordId, ) -> QuillSQLResult<()>
pub fn full_tuple(&self, rid: RecordId) -> QuillSQLResult<(TupleMeta, Tuple)>
pub fn tuple(&self, rid: RecordId) -> QuillSQLResult<Tuple>
pub fn tuple_meta(&self, rid: RecordId) -> QuillSQLResult<TupleMeta>
pub fn get_first_rid(&self) -> QuillSQLResult<Option<RecordId>>
pub fn get_next_rid(&self, rid: RecordId) -> QuillSQLResult<Option<RecordId>>
Sourcepub fn recovery_view(buffer_pool: Arc<BufferManager>) -> Self
pub fn recovery_view(buffer_pool: Arc<BufferManager>) -> Self
Construct a lightweight TableHeap view for recovery operations. This instance uses an empty schema and does not rely on first/last page ids.
Sourcepub fn recover_set_tuple_meta(
&self,
rid: RecordId,
meta: TupleMeta,
) -> QuillSQLResult<()>
pub fn recover_set_tuple_meta( &self, rid: RecordId, meta: TupleMeta, ) -> QuillSQLResult<()>
Recovery-only API: set tuple meta without emitting WAL. Only used by RecoveryManager during UNDO.
Sourcepub fn recover_set_tuple_bytes(
&self,
rid: RecordId,
new_bytes: &[u8],
) -> QuillSQLResult<()>
pub fn recover_set_tuple_bytes( &self, rid: RecordId, new_bytes: &[u8], ) -> QuillSQLResult<()>
Recovery-only API: set tuple raw bytes without emitting WAL. If size mismatches, repack tuple area and update offsets.
pub fn recover_restore_tuple( &self, rid: RecordId, meta: TupleMeta, tuple: &Tuple, ) -> QuillSQLResult<()>
pub fn recover_delete_tuple( &self, rid: RecordId, txn_id: TransactionId, cid: CommandId, ) -> QuillSQLResult<()>
pub fn delete_tuple( &self, rid: RecordId, txn_id: TransactionId, cid: CommandId, ) -> QuillSQLResult<()>
Sourcepub fn vacuum_slot_if<F>(
&self,
rid: RecordId,
predicate: F,
) -> QuillSQLResult<bool>
pub fn vacuum_slot_if<F>( &self, rid: RecordId, predicate: F, ) -> QuillSQLResult<bool>
Attempt to reclaim the tuple at rid if predicate returns true for the current metadata.
Returns true when the tuple was removed.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TableHeap
impl !RefUnwindSafe for TableHeap
impl Send for TableHeap
impl Sync for TableHeap
impl Unpin for TableHeap
impl !UnwindSafe for TableHeap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
Source§fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
Source§fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
Source§fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
Source§fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
Source§fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
Source§fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
Source§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
Source§fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
Source§fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
Source§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Source§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Source§fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Source§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Source§fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
Source§fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
Source§fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
Source§fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
Source§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
Source§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
Source§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
Source§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
Source§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
Source§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
Source§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
Source§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
Source§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
Source§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
Source§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
Source§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
Source§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Source§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Source§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Source§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Source§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
Source§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
Source§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
Source§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
Source§fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
Source§fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
Source§fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
Source§fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
Source§fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
Source§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
Source§fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
Source§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more