mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-29 12:54:22 +01:00
wip
This commit is contained in:
@@ -15,6 +15,7 @@ mod json;
|
||||
pub mod mvcc;
|
||||
mod parameters;
|
||||
mod pragma;
|
||||
pub mod primitives;
|
||||
mod pseudo;
|
||||
mod schema;
|
||||
#[cfg(feature = "series")]
|
||||
|
||||
@@ -41,7 +41,7 @@ use super::{
|
||||
use parking_lot::RwLock;
|
||||
use std::{
|
||||
any::Any,
|
||||
cell::{Cell, Ref, RefCell},
|
||||
cell::Cell,
|
||||
cmp::{Ordering, Reverse},
|
||||
collections::{BinaryHeap, HashMap},
|
||||
fmt::Debug,
|
||||
@@ -50,6 +50,8 @@ use std::{
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use crate::primitives::{Ref, RefCell, RefMut};
|
||||
|
||||
/// The B-Tree page header is 12 bytes for interior pages and 8 bytes for leaf pages.
|
||||
///
|
||||
/// +--------+-----------------+-----------------+-----------------+--------+----- ..... ----+
|
||||
@@ -552,7 +554,7 @@ pub trait CursorTrait: Any {
|
||||
// --- start: BTreeCursor specific functions ----
|
||||
fn invalidate_record(&mut self);
|
||||
fn has_rowid(&self) -> bool;
|
||||
fn record_cursor_mut(&self) -> std::cell::RefMut<'_, RecordCursor>;
|
||||
fn record_cursor_mut(&self) -> RefMut<'_, RecordCursor>;
|
||||
fn get_pager(&self) -> Arc<Pager>;
|
||||
fn get_skip_advance(&self) -> bool;
|
||||
|
||||
@@ -5422,7 +5424,7 @@ impl BTreeCursor {
|
||||
Ok(IOResult::Done(()))
|
||||
}
|
||||
|
||||
fn get_immutable_record_or_create(&self) -> std::cell::RefMut<'_, Option<ImmutableRecord>> {
|
||||
fn get_immutable_record_or_create(&self) -> RefMut<'_, Option<ImmutableRecord>> {
|
||||
let mut reusable_immutable_record = self.reusable_immutable_record.borrow_mut();
|
||||
if reusable_immutable_record.is_none() {
|
||||
let page_size = self.pager.get_page_size_unchecked().get();
|
||||
@@ -5432,7 +5434,7 @@ impl BTreeCursor {
|
||||
reusable_immutable_record
|
||||
}
|
||||
|
||||
fn get_immutable_record(&self) -> std::cell::RefMut<'_, Option<ImmutableRecord>> {
|
||||
fn get_immutable_record(&self) -> RefMut<'_, Option<ImmutableRecord>> {
|
||||
self.reusable_immutable_record.borrow_mut()
|
||||
}
|
||||
|
||||
@@ -6390,7 +6392,7 @@ impl CursorTrait for BTreeCursor {
|
||||
.invalidate();
|
||||
self.record_cursor.borrow_mut().invalidate();
|
||||
}
|
||||
fn record_cursor_mut(&self) -> std::cell::RefMut<'_, RecordCursor> {
|
||||
fn record_cursor_mut(&self) -> RefMut<'_, RecordCursor> {
|
||||
self.record_cursor.borrow_mut()
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ macro_rules! load_insn {
|
||||
};
|
||||
#[cfg(not(debug_assertions))]
|
||||
let Insn::$variant { $($field $(: $binding)?),*} = $insn else {
|
||||
// this will optimize away the branch
|
||||
// this will optimize away the branch
|
||||
unsafe { std::hint::unreachable_unchecked() };
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user