diff options
author | Determinant <[email protected]> | 2020-06-11 18:20:42 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-06-11 18:20:42 -0400 |
commit | ba04108ee179b00c97708aa6ece6c6fff53101d0 (patch) | |
tree | 9e296a728f7825957f9495993d58462f0144a4e5 /tests/common/mod.rs | |
parent | d3137d4c37d66ace3ea4583afa3edfed48f42988 (diff) |
tentatively add async fn
Diffstat (limited to 'tests/common/mod.rs')
-rw-r--r-- | tests/common/mod.rs | 8 |
1 files changed, 5 insertions, 3 deletions
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<G: FailGen> { fgen: Rc<G>, } +#[async_trait(?Send)] impl<G: FailGen> WALFile for WALFileEmul<G> { - 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<G: FailGen> WALFile for WALFileEmul<G> { 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() { |