MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / checkpoint

Method checkpoint

src/db/connection.rs:218–227  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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<()> {

Calls

no outgoing calls

Tested by

no test coverage detected