pub struct MaintenanceService { /* private fields */ }Expand description
Maintenance service for database upkeep
Implementations§
Source§impl MaintenanceService
impl MaintenanceService
Sourcepub fn new(pool: DatabasePool, config: MaintenanceConfig) -> Self
pub fn new(pool: DatabasePool, config: MaintenanceConfig) -> Self
Create a new maintenance service
Sourcepub async fn run_maintenance(&self) -> Result<MaintenanceResults>
pub async fn run_maintenance(&self) -> Result<MaintenanceResults>
Run all maintenance operations
Sourcepub async fn vacuum_table(&self, _table_name: &str) -> Result<()>
pub async fn vacuum_table(&self, _table_name: &str) -> Result<()>
VACUUM a specific table
Sourcepub async fn analyze_table(&self, table_name: &str) -> Result<()>
pub async fn analyze_table(&self, table_name: &str) -> Result<()>
ANALYZE a specific table
Sourcepub async fn get_table_stats(&self, table_name: &str) -> Result<TableStats>
pub async fn get_table_stats(&self, table_name: &str) -> Result<TableStats>
Get statistics for a specific table
Sourcepub async fn list_tables(&self) -> Result<Vec<String>>
pub async fn list_tables(&self) -> Result<Vec<String>>
List all user tables
Sourcepub async fn get_database_size(&self) -> Result<i64>
pub async fn get_database_size(&self) -> Result<i64>
Get database size in bytes
Note: For SQLite, this returns the page count * page size
Sourcepub async fn get_database_size_mb(&self) -> Result<f64>
pub async fn get_database_size_mb(&self) -> Result<f64>
Get database size in megabytes
Sourcepub async fn get_index_info(&self) -> Result<Vec<IndexBloatInfo>>
pub async fn get_index_info(&self) -> Result<Vec<IndexBloatInfo>>
Get index information
Sourcepub async fn integrity_check(&self) -> Result<bool>
pub async fn integrity_check(&self) -> Result<bool>
Check database integrity
Sourcepub async fn get_freelist_count(&self) -> Result<i64>
pub async fn get_freelist_count(&self) -> Result<i64>
Get freelist count (unused pages)
Auto Trait Implementations§
impl Freeze for MaintenanceService
impl !RefUnwindSafe for MaintenanceService
impl Send for MaintenanceService
impl Sync for MaintenanceService
impl Unpin for MaintenanceService
impl !UnwindSafe for MaintenanceService
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
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>
Converts
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>
Converts
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 more