diff options
Diffstat (limited to 'src/core/index.rs')
-rw-r--r-- | src/core/index.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/index.rs b/src/core/index.rs index 50d184d..ac0bea3 100644 --- a/src/core/index.rs +++ b/src/core/index.rs @@ -26,9 +26,10 @@ use crate::IndexWriter; use crate::Result; use num_cpus; use std::borrow::BorrowMut; +use std::collections::HashSet; use std::fmt; #[cfg(feature = "mmap")] -use std::path::Path; +use std::path::{Path, PathBuf}; use std::sync::Arc; fn load_metas(directory: &dyn Directory, inventory: &SegmentMetaInventory) -> Result<IndexMeta> { @@ -368,6 +369,11 @@ impl Index { .map(SegmentMeta::id) .collect()) } + + /// Returns the set of corrupted files + pub fn validate_checksum(&self) -> Result<HashSet<PathBuf>> { + self.directory.list_damaged().map_err(Into::into) + } } impl fmt::Debug for Index { |