core/io: Switch to Arc<Completion>

This commit is contained in:
Pekka Enberg
2025-05-22 09:32:16 +03:00
parent 21535018aa
commit eca9a5b703
14 changed files with 78 additions and 63 deletions

View File

@@ -444,8 +444,8 @@ impl DatabaseFile {
}
impl limbo_core::DatabaseStorage for DatabaseFile {
fn read_page(&self, page_idx: usize, c: limbo_core::Completion) -> limbo_core::Result<()> {
let r = match c {
fn read_page(&self, page_idx: usize, c: Arc<limbo_core::Completion>) -> limbo_core::Result<()> {
let r = match *c {
limbo_core::Completion::Read(ref r) => r,
_ => unreachable!(),
};
@@ -463,7 +463,7 @@ impl limbo_core::DatabaseStorage for DatabaseFile {
&self,
page_idx: usize,
buffer: Arc<std::cell::RefCell<limbo_core::Buffer>>,
c: limbo_core::Completion,
c: Arc<limbo_core::Completion>,
) -> limbo_core::Result<()> {
let size = buffer.borrow().len();
let pos = (page_idx - 1) * size;
@@ -471,7 +471,7 @@ impl limbo_core::DatabaseStorage for DatabaseFile {
Ok(())
}
fn sync(&self, c: limbo_core::Completion) -> limbo_core::Result<()> {
fn sync(&self, c: Arc<limbo_core::Completion>) -> limbo_core::Result<()> {
self.file.sync(c)
}
}