pub struct RemDb {
pub config: &'static DbConfig,
pub snapshot_version: u32,
pub metrics: DbMetrics,
/* private fields */
}Expand description
数据库实例
Fields§
§config: &'static DbConfig数据库配置
snapshot_version: u32全局快照版本号
metrics: DbMetrics数据库监控指标
Implementations§
Source§impl RemDb
impl RemDb
Sourcepub fn get_table(&self, table_id: usize) -> Result<&MemoryTable>
pub fn get_table(&self, table_id: usize) -> Result<&MemoryTable>
获取表
Sourcepub fn get_table_mut(&mut self, table_id: usize) -> Result<&mut MemoryTable>
pub fn get_table_mut(&mut self, table_id: usize) -> Result<&mut MemoryTable>
获取表(可变)
Sourcepub fn get_primary_index(&self, table_id: usize) -> Result<&PrimaryIndex>
pub fn get_primary_index(&self, table_id: usize) -> Result<&PrimaryIndex>
获取主键索引
Sourcepub fn get_primary_index_mut(
&mut self,
table_id: usize,
) -> Result<&mut PrimaryIndex>
pub fn get_primary_index_mut( &mut self, table_id: usize, ) -> Result<&mut PrimaryIndex>
获取主键索引(可变)
Sourcepub fn get_secondary_index(&self, table_id: usize) -> Result<&AnySecondaryIndex>
pub fn get_secondary_index(&self, table_id: usize) -> Result<&AnySecondaryIndex>
获取辅助索引
Sourcepub fn get_secondary_index_mut(
&mut self,
table_id: usize,
) -> Result<&mut AnySecondaryIndex>
pub fn get_secondary_index_mut( &mut self, table_id: usize, ) -> Result<&mut AnySecondaryIndex>
获取辅助索引(可变)
Sourcepub fn is_low_power_mode(&self) -> bool
pub fn is_low_power_mode(&self) -> bool
检查是否处于低功耗模式
Sourcepub fn enter_low_power_mode(&mut self) -> Result<()>
pub fn enter_low_power_mode(&mut self) -> Result<()>
进入低功耗模式
Sourcepub fn exit_low_power_mode(&mut self) -> Result<()>
pub fn exit_low_power_mode(&mut self) -> Result<()>
退出低功耗模式
Sourcepub unsafe fn begin_transaction(
&mut self,
tx_type: TransactionType,
isolation_level: IsolationLevel,
tx_buffer: *mut Transaction,
log_buffer: *mut LogItem,
max_log_items: usize,
) -> Result<NonNull<Transaction>>
pub unsafe fn begin_transaction( &mut self, tx_type: TransactionType, isolation_level: IsolationLevel, tx_buffer: *mut Transaction, log_buffer: *mut LogItem, max_log_items: usize, ) -> Result<NonNull<Transaction>>
开始事务
Sourcepub unsafe fn commit_transaction(&mut self) -> Result<()>
pub unsafe fn commit_transaction(&mut self) -> Result<()>
提交事务
Sourcepub unsafe fn rollback_transaction(&mut self) -> Result<()>
pub unsafe fn rollback_transaction(&mut self) -> Result<()>
回滚事务
Sourcepub fn save_snapshot(&mut self, path: &str) -> Result<()>
pub fn save_snapshot(&mut self, path: &str) -> Result<()>
保存快照到文件
Sourcepub fn restore_snapshot(&mut self, path: &str) -> Result<()>
pub fn restore_snapshot(&mut self, path: &str) -> Result<()>
从文件恢复快照
Sourcepub fn get_metrics(&self) -> &DbMetrics
pub fn get_metrics(&self) -> &DbMetrics
获取当前监控指标
Sourcepub fn metrics_snapshot(&self) -> DbMetricsSnapshot
pub fn metrics_snapshot(&self) -> DbMetricsSnapshot
创建指标快照
Sourcepub fn reset_metrics(&self)
pub fn reset_metrics(&self)
重置所有监控指标
Sourcepub fn health_check(&self) -> HealthCheckResult
pub fn health_check(&self) -> HealthCheckResult
执行健康检查
Trait Implementations§
Source§impl DdlExecutor for RemDb
为RemDb实现DdlExecutor trait
impl DdlExecutor for RemDb
为RemDb实现DdlExecutor trait
impl Send for RemDb
impl Sync for RemDb
Auto Trait Implementations§
impl !Freeze for RemDb
impl !RefUnwindSafe for RemDb
impl Unpin for RemDb
impl !UnwindSafe for RemDb
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