mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 01:04:22 +01:00
Merge 'Cursor cleanups' from Pekka Enberg
Clean up the cursor lookup code in VDBE in preparation for multi-version cursor support. Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #1090
This commit is contained in:
@@ -619,20 +619,15 @@ impl Record {
|
||||
}
|
||||
|
||||
pub enum Cursor {
|
||||
Table(BTreeCursor),
|
||||
Index(BTreeCursor),
|
||||
BTree(BTreeCursor),
|
||||
Pseudo(PseudoCursor),
|
||||
Sorter(Sorter),
|
||||
Virtual(VTabOpaqueCursor),
|
||||
}
|
||||
|
||||
impl Cursor {
|
||||
pub fn new_table(cursor: BTreeCursor) -> Self {
|
||||
Self::Table(cursor)
|
||||
}
|
||||
|
||||
pub fn new_index(cursor: BTreeCursor) -> Self {
|
||||
Self::Index(cursor)
|
||||
pub fn new_btree(cursor: BTreeCursor) -> Self {
|
||||
Self::BTree(cursor)
|
||||
}
|
||||
|
||||
pub fn new_pseudo(cursor: PseudoCursor) -> Self {
|
||||
@@ -643,17 +638,10 @@ impl Cursor {
|
||||
Self::Sorter(cursor)
|
||||
}
|
||||
|
||||
pub fn as_table_mut(&mut self) -> &mut BTreeCursor {
|
||||
pub fn as_btree_mut(&mut self) -> &mut BTreeCursor {
|
||||
match self {
|
||||
Self::Table(cursor) => cursor,
|
||||
_ => panic!("Cursor is not a table"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_index_mut(&mut self) -> &mut BTreeCursor {
|
||||
match self {
|
||||
Self::Index(cursor) => cursor,
|
||||
_ => panic!("Cursor is not an index"),
|
||||
Self::BTree(cursor) => cursor,
|
||||
_ => panic!("Cursor is not a btree"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
821
core/vdbe/mod.rs
821
core/vdbe/mod.rs
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user