pub struct PrimaryIndex { /* private fields */ }Expand description
主键哈希索引
Implementations§
Source§impl PrimaryIndex
impl PrimaryIndex
Sourcepub unsafe fn new(
def: Arc<TableDef>,
hash_table_start: *mut Option<NonNull<PrimaryIndexItem>>,
items_start: *mut PrimaryIndexItem,
hash_table_size: usize,
max_items: usize,
) -> Self
pub unsafe fn new( def: Arc<TableDef>, hash_table_start: *mut Option<NonNull<PrimaryIndexItem>>, items_start: *mut PrimaryIndexItem, hash_table_size: usize, max_items: usize, ) -> Self
创建新的主键索引
Sourcepub const fn calculate_memory_size(
_def: &TableDef,
hash_table_size: usize,
max_items: usize,
) -> usize
pub const fn calculate_memory_size( _def: &TableDef, hash_table_size: usize, max_items: usize, ) -> usize
计算主键索引所需的内存大小
Sourcepub unsafe fn insert(
&mut self,
key: *const u8,
key_size: usize,
record_id: u16,
) -> Result<()>
pub unsafe fn insert( &mut self, key: *const u8, key_size: usize, record_id: u16, ) -> Result<()>
插入索引项
Sourcepub unsafe fn insert_composite(
&mut self,
record_ptr: *const u8,
record_id: u16,
) -> Result<()>
pub unsafe fn insert_composite( &mut self, record_ptr: *const u8, record_id: u16, ) -> Result<()>
插入复合主键索引�?
Sourcepub unsafe fn find_composite(&mut self, record_ptr: *const u8) -> Result<u16>
pub unsafe fn find_composite(&mut self, record_ptr: *const u8) -> Result<u16>
根据记录指针查找复合主键对应的记录ID
Sourcepub unsafe fn delete_composite(&mut self, record_ptr: *const u8) -> Result<()>
pub unsafe fn delete_composite(&mut self, record_ptr: *const u8) -> Result<()>
根据记录指针删除复合主键索引�?
Sourcepub fn stats(&self) -> &IndexStats
pub fn stats(&self) -> &IndexStats
获取索引统计信息
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
重置索引统计信息
Auto Trait Implementations§
impl !Send for PrimaryIndex
impl !Sync for PrimaryIndex
impl Freeze for PrimaryIndex
impl RefUnwindSafe for PrimaryIndex
impl Unpin for PrimaryIndex
impl UnsafeUnpin for PrimaryIndex
impl UnwindSafe for PrimaryIndex
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
Mutably borrows from an owned value. Read more