diff options
author | Determinant <[email protected]> | 2020-06-12 14:30:12 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-06-12 14:30:12 -0400 |
commit | 5b6bb306bb1d20bdab0e1d7752f2b7b7f16a2b7e (patch) | |
tree | 6527068a490257de43f4c7a6148b44d8031bcb4b /examples/demo1.rs | |
parent | 4b2c4cdf5de3e7bd1df954dccc320806b18fd1fb (diff) |
async write works
Diffstat (limited to 'examples/demo1.rs')
-rw-r--r-- | examples/demo1.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/demo1.rs b/examples/demo1.rs index 5ee2b64..a360885 100644 --- a/examples/demo1.rs +++ b/examples/demo1.rs @@ -91,16 +91,17 @@ impl Drop for WALStoreTest { } } +#[async_trait(?Send)] impl WALStore for WALStoreTest { type FileNameIter = std::vec::IntoIter<String>; - fn open_file(&mut self, filename: &str, touch: bool) -> Result<Box<dyn WALFile>, ()> { + async fn open_file(&self, filename: &str, touch: bool) -> Result<Box<dyn WALFile>, ()> { println!("open_file(filename={}, touch={})", filename, touch); let filename = filename.to_string(); WALFileTest::new(self.rootfd, &filename).and_then(|f| Ok(Box::new(f) as Box<dyn WALFile>)) } - fn remove_file(&mut self, filename: &str) -> Result<(), ()> { + fn remove_file(&self, filename: &str) -> Result<(), ()> { println!("remove_file(filename={})", filename); unlinkat(Some(self.rootfd), filename, UnlinkatFlags::NoRemoveDir).or_else(|_| Err(())) } @@ -114,7 +115,7 @@ impl WALStore for WALStoreTest { Ok(logfiles.into_iter()) } - fn apply_payload(&mut self, payload: WALBytes, ringid: WALRingId) -> Result<(), ()> { + fn apply_payload(&self, payload: WALBytes, ringid: WALRingId) -> Result<(), ()> { println!("apply_payload(payload={}, ringid={:?})", std::str::from_utf8(&payload).unwrap(), ringid); |