aboutsummaryrefslogtreecommitdiff
path: root/examples/demo1.rs
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-06-12 14:30:12 -0400
committerDeterminant <[email protected]>2020-06-12 14:30:12 -0400
commit5b6bb306bb1d20bdab0e1d7752f2b7b7f16a2b7e (patch)
tree6527068a490257de43f4c7a6148b44d8031bcb4b /examples/demo1.rs
parent4b2c4cdf5de3e7bd1df954dccc320806b18fd1fb (diff)
async write works
Diffstat (limited to 'examples/demo1.rs')
-rw-r--r--examples/demo1.rs7
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);