keep track when fsync is called

This commit is contained in:
pedrocarlo
2025-06-27 15:31:58 -03:00
parent 0e9ee4b856
commit f806d97d0f
2 changed files with 6 additions and 1 deletions

View File

@@ -31,6 +31,8 @@ pub(crate) struct SimulatorFile {
pub(crate) rng: RefCell<ChaCha8Rng>,
pub latency_probability: usize,
pub sync_completion: RefCell<Option<Arc<limbo_core::Completion>>>,
}
unsafe impl Send for SimulatorFile {}
@@ -185,7 +187,9 @@ impl File for SimulatorFile {
};
sync_completion.complete = Box::new(new_complete);
};
self.inner.sync(c)
let c = self.inner.sync(c)?;
*self.sync_completion.borrow_mut() = Some(c.clone());
Ok(c)
}
fn size(&self) -> Result<u64> {

View File

@@ -85,6 +85,7 @@ impl IO for SimulatorIO {
page_size: self.page_size,
rng: RefCell::new(ChaCha8Rng::seed_from_u64(self.seed)),
latency_probability: self.latency_probability,
sync_completion: RefCell::new(None),
});
self.files.borrow_mut().push(file.clone());
Ok(file)