diff options
author | Determinant <[email protected]> | 2020-06-10 12:45:25 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-06-10 12:45:25 -0400 |
commit | 81eb9ce9299b2e31471db3f00457ff3c1a41fb60 (patch) | |
tree | e98f6fcd416ac9ebf22f5fb47eecf2f836d7dc51 /examples | |
parent | f8fd7a86c11bf15a41cd402b2ef8fe457f0c2026 (diff) |
filter out other non-WAL files
Diffstat (limited to 'examples')
-rw-r--r-- | examples/demo1.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/demo1.rs b/examples/demo1.rs index 104c3b0..e0c7d58 100644 --- a/examples/demo1.rs +++ b/examples/demo1.rs @@ -87,6 +87,8 @@ impl Drop for WALStoreTest { } impl WALStore for WALStoreTest { + type FileNameIter = std::vec::IntoIter<String>; + fn open_file(&self, filename: &str, touch: bool) -> Option<Box<dyn WALFile>> { println!("open_file(filename={}, touch={})", filename, touch); let filename = filename.to_string(); @@ -98,13 +100,13 @@ impl WALStore for WALStoreTest { unlinkat(Some(self.rootfd), filename, UnlinkatFlags::NoRemoveDir).or_else(|_| Err(())) } - fn enumerate_files(&self) -> Box<[String]> { + fn enumerate_files(&self) -> Self::FileNameIter { println!("enumerate_files()"); let mut logfiles = Vec::new(); for fname in std::fs::read_dir(&self.rootpath).unwrap() { logfiles.push(fname.unwrap().file_name().into_string().unwrap()) } - logfiles.into_boxed_slice() + logfiles.into_iter() } fn apply_payload(&self, payload: WALBytes) { |