From 02df3728112e217d6bd879e2ad31b0e2a51d03c3 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Mon, 25 Aug 2025 16:19:05 -0400 Subject: [PATCH] Add cancel and drain methods to IO trait --- core/io/mod.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/io/mod.rs b/core/io/mod.rs index 2922004d2..15028f7eb 100644 --- a/core/io/mod.rs +++ b/core/io/mod.rs @@ -50,9 +50,6 @@ pub trait File: Send + Sync { }) }; if let Err(e) = self.pwrite(pos, buf.clone(), child_c) { - // best-effort: mark as abort so caller won't wait forever - // TODO: when we have `pwrite` and other I/O methods return CompletionError - // instead of LimboError, store the error inside c.abort(); return Err(e); } @@ -91,6 +88,15 @@ pub trait IO: Clock + Send + Sync { Ok(()) } + fn cancel(&self, c: &[Completion]) -> Result<()> { + c.iter().for_each(|c| c.abort()); + Ok(()) + } + + fn drain(&self) -> Result<()> { + Ok(()) + } + fn wait_for_completion(&self, c: Completion) -> Result<()> { while !c.finished() { self.run_once()?