This pr adds support for multiple readers and a single writer with a
custom made lock called `LimboRwLock`. Basically there are 5 allowed
read locks which store the max frame allowed in that "snapshot" and any
reader will try to acquire the biggest one possible. Writer will just
try to lock the `write_lock` and if not successful, it will return busy.
The only checkpoint mode supported for now is `PASSIVE` but it should be
trivial to add more modes.
This needs testing, but I will do it in another PR. I just wanted to do
it in another PR.
Closes#544
This adds an interrupt() method to Statement that allows apps to
interrupt a running statement. Please note that this is different from
`sqlite3_interrupt()` which interrupts all ongoing operations in a
database. Although we want to support that too, per statement interrupt
is much more useful to apps.
Switch to to_string() and to_vec() instead of clone() + to_owned() to
fix the following warnings:
warning: using `.clone()` on a double reference, which returns `&String` instead of cloning the inner type
--> simulator/main.rs:348:68
|
348 | limbo_core::Value::Text(t) => Value::Text(t.clone().to_owned()),
| ^^^^^^^^
|
= note: `#[warn(suspicious_double_ref_op)]` on by default
warning: using `.clone()` on a double reference, which returns `&Vec<u8>` instead of cloning the inner type
--> simulator/main.rs:349:68
|
349 | limbo_core::Value::Blob(b) => Value::Blob(b.clone().to_owned()),
We inject fault before calling next_row() through which we'll get pread
faults. Also we call io's run_once on getting RowResult::IO. This is run
with a fault probability of 1%. This is less because a fault here would
result us in terminating the entire loop iterating on rows, and also
because realistically we'll expect less faults here