From ba04108ee179b00c97708aa6ece6c6fff53101d0 Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 11 Jun 2020 18:20:42 -0400 Subject: tentatively add async fn --- tests/common/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/common/mod.rs') diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 6e35ea1..ba302f9 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -1,6 +1,7 @@ #[cfg(test)] #[allow(dead_code)] extern crate growthring; +use async_trait::async_trait; use growthring::wal::{ WALBytes, WALFile, WALLoader, WALPos, WALRingId, WALStore, }; @@ -37,8 +38,9 @@ pub struct WALFileEmul { fgen: Rc, } +#[async_trait(?Send)] impl WALFile for WALFileEmul { - fn allocate(&self, offset: WALPos, length: usize) -> Result<(), ()> { + async fn allocate(&self, offset: WALPos, length: usize) -> Result<(), ()> { if self.fgen.next_fail() { return Err(()); } @@ -60,7 +62,7 @@ impl WALFile for WALFileEmul { Ok(()) } - fn write(&self, offset: WALPos, data: WALBytes) -> Result<(), ()> { + async fn write(&self, offset: WALPos, data: WALBytes) -> Result<(), ()> { if self.fgen.next_fail() { return Err(()); } @@ -548,7 +550,7 @@ impl PaintingSim { ringid_map.insert(*rid, ops.len() - 1); } // grow could fail - ok?; + futures::executor::block_on(ok)?; // finish appending to WAL /* for rid in rids.iter() { -- cgit v1.2.3-70-g09d2