Checkpoints the WAL back into the main database file. This ensures all committed transactions are merged into the main DB before the process exits, preventing a stale WAL file on next startup.
(&self)
| 216 | /// This ensures all committed transactions are merged into the main DB |
| 217 | /// before the process exits, preventing a stale WAL file on next startup. |
| 218 | pub async fn checkpoint(&self) -> Result<()> { |
| 219 | self.conn |
| 220 | .execute_batch("PRAGMA wal_checkpoint(TRUNCATE);") |
| 221 | .await |
| 222 | .map_err(|e| TraceDecayError::Database { |
| 223 | message: format!("failed to checkpoint WAL: {e}"), |
| 224 | operation: "checkpoint".to_string(), |
| 225 | })?; |
| 226 | Ok(()) |
| 227 | } |
| 228 | |
| 229 | /// Runs VACUUM and ANALYZE to reclaim space and update query planner statistics. |
| 230 | pub async fn optimize(&self) -> Result<()> { |
no outgoing calls
no test coverage detected