mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-19 01:24:20 +01:00
Small cleanups to pager/wal/vdbe - mostly naming
- Instead of using a confusing CheckpointStatus for many different things,
introduce the following statuses:
* PagerCacheflushStatus - cacheflush can result in either:
- the WAL being written to disk and fsynced
- but also a checkpoint to the main BD file, and fsyncing the main DB file
Reflect this in the type.
* WalFsyncStatus - previously CheckpointStatus was also used for this, even
though fsyncing the WAL doesn't checkpoint.
* CheckpointStatus/CheckpointResult is now used only for actual checkpointing.
- Rename HaltState to CommitState (program.halt_state -> program.commit_state)
- Make WAL a non-optional property in Pager
* This gets rid of a lot of if let Some(...) boilerplate
* For ephemeral indexes, provide a DummyWAL implementation that does nothing.
- Rename program.halt() to program.commit_txn()
- Add some documentation comments to structs and functions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use limbo_core::{CheckpointStatus, Connection, Database, IO};
|
||||
use limbo_core::{Connection, Database, PagerCacheflushStatus, IO};
|
||||
use rand::{rng, RngCore};
|
||||
use rusqlite::params;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -86,10 +86,10 @@ impl TempDatabase {
|
||||
pub(crate) fn do_flush(conn: &Rc<Connection>, tmp_db: &TempDatabase) -> anyhow::Result<()> {
|
||||
loop {
|
||||
match conn.cacheflush()? {
|
||||
CheckpointStatus::Done(_) => {
|
||||
PagerCacheflushStatus::Done(_) => {
|
||||
break;
|
||||
}
|
||||
CheckpointStatus::IO => {
|
||||
PagerCacheflushStatus::IO => {
|
||||
tmp_db.io.run_once()?;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user