Skip to content

Commit 2125b60

Browse files
committed
f Remove KVStoreUnpersister
1 parent 0c4e18b commit 2125b60

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

src/io/fs_store.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[cfg(target_os = "windows")]
22
extern crate winapi;
33

4-
use super::{KVStore, KVStoreUnpersister, TransactionalWrite};
4+
use super::{KVStore, TransactionalWrite};
55

66
use std::fs;
77
use std::io::{BufReader, BufWriter, Read, Write};
@@ -90,7 +90,7 @@ impl KVStore for FilesystemStore {
9090
}
9191

9292
if dest_file.is_file() {
93-
return Err(std::io::Error::new(std::io::ErrorKind::Other, "Unpersisting key failed"));
93+
return Err(std::io::Error::new(std::io::ErrorKind::Other, "Removing key failed"));
9494
}
9595

9696
Ok(true)
@@ -256,20 +256,6 @@ impl KVStorePersister for FilesystemStore {
256256
}
257257
}
258258

259-
impl KVStoreUnpersister for FilesystemStore {
260-
fn unpersist(&self, key: &str) -> std::io::Result<bool> {
261-
let msg = format!("Could not retrieve file for key {}.", key);
262-
let dest_file = PathBuf::from_str(key)
263-
.map_err(|_| lightning::io::Error::new(lightning::io::ErrorKind::InvalidInput, msg))?;
264-
let msg = format!("Could not retrieve parent directory of {}.", dest_file.display());
265-
let parent_directory = dest_file
266-
.parent()
267-
.ok_or(lightning::io::Error::new(lightning::io::ErrorKind::InvalidInput, msg))?;
268-
let namespace = parent_directory.display().to_string();
269-
self.remove(&namespace, key)
270-
}
271-
}
272-
273259
#[cfg(test)]
274260
mod tests {
275261
use super::*;

src/io/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,3 @@ pub trait TransactionalWrite: Write {
9595
// Ok(writer.commit()?)
9696
// }
9797
//}
98-
99-
/// Provides an interface that allows a previously persisted key to be unpersisted.
100-
pub trait KVStoreUnpersister {
101-
/// Unpersist (i.e., remove) the writeable previously persisted under the provided key.
102-
/// Returns `true` if the key was present, and `false` otherwise.
103-
fn unpersist(&self, key: &str) -> std::io::Result<bool>;
104-
}

0 commit comments

Comments
 (0)