Commit
+0 -34 +/-1 browse
1 | diff --git a/src/lru.rs b/src/lru.rs |
2 | index ee070fc..5744d97 100644 |
3 | --- a/src/lru.rs |
4 | +++ b/src/lru.rs |
5 | @@ -114,38 +114,4 @@ where |
6 | None |
7 | } |
8 | } |
9 | - |
10 | - /// Returns a future that prunes the least recently used entries that cause |
11 | - /// the cache to exceed the given maximum size. |
12 | - /// |
13 | - /// If the stream is thrown away, then the items will not be deleted. |
14 | - #[cfg(none)] |
15 | - pub fn prune( |
16 | - &mut self, |
17 | - root: PathBuf, |
18 | - max_size: u64, |
19 | - ) -> impl Future<Item = usize, Error = io::Error> { |
20 | - if max_size == 0 { |
21 | - return Either::A(future::ok(0)); |
22 | - } |
23 | - |
24 | - let mut to_delete = Vec::new(); |
25 | - |
26 | - while self.size() > max_size { |
27 | - if let Some((oid, _)) = self.pop() { |
28 | - to_delete.push(oid); |
29 | - } |
30 | - } |
31 | - |
32 | - Either::B(stream::iter_ok(to_delete).fold(0, move |acc, oid| { |
33 | - let path = root.join(format!("objects/{}", oid.path())); |
34 | - |
35 | - fs::remove_file(path) |
36 | - .map_err(move |e| { |
37 | - log::error!("Failed to delete '{}' ({})", oid, e); |
38 | - e |
39 | - }) |
40 | - .map(move |()| acc + 1) |
41 | - })) |
42 | - } |
43 | } |