[−][src]Struct tantivy::directory::ManagedDirectory
Wrapper of directories that keeps track of files created by Tantivy.
A managed directory is just a wrapper of a directory that keeps a (persisted) list of the files that have been created (and not deleted) by tantivy so far.
Thanks to this list, it implements a garbage_collect
method
that removes the files that were created by tantivy and are not
useful anymore.
Methods
impl ManagedDirectory
[src]
pub fn wrap<Dir: Directory>(directory: Dir) -> Result<ManagedDirectory>
[src]
Wraps a directory as managed directory.
pub fn garbage_collect<L: FnOnce() -> HashSet<PathBuf>>(
&mut self,
get_living_files: L
) -> Result<GarbageCollectionResult>
[src]
&mut self,
get_living_files: L
) -> Result<GarbageCollectionResult>
Garbage collect unused files.
Removes the files that were created by tantivy
and are not
used by any segment anymore.
living_files
- List of files that are still used by the index.
The use a callback ensures that the list of living_files is computed while we hold the lock on meta.
This method does not panick nor returns errors. If a file cannot be deleted (for permission reasons for instance) an error is simply logged, and the file remains in the list of managed files.
pub fn validate_checksum(&self, path: &Path) -> Result<bool, OpenReadError>
[src]
Verify checksum of a managed file
pub fn list_damaged(&self) -> Result<HashSet<PathBuf>, OpenReadError>
[src]
List files for which checksum does not match content
Trait Implementations
impl Clone for ManagedDirectory
[src]
fn clone(&self) -> ManagedDirectory
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ManagedDirectory
[src]
impl Directory for ManagedDirectory
[src]
fn open_read(&self, path: &Path) -> Result<ReadOnlySource, OpenReadError>
[src]
fn open_write(&mut self, path: &Path) -> Result<WritePtr, OpenWriteError>
[src]
fn atomic_write(&mut self, path: &Path, data: &[u8]) -> Result<()>
[src]
fn atomic_read(&self, path: &Path) -> Result<Vec<u8>, OpenReadError>
[src]
fn delete(&self, path: &Path) -> Result<(), DeleteError>
[src]
fn exists(&self, path: &Path) -> bool
[src]
fn acquire_lock(&self, lock: &Lock) -> Result<DirectoryLock, LockError>
[src]
fn watch(&self, watch_callback: WatchCallback) -> Result<WatchHandle>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ManagedDirectory
impl Send for ManagedDirectory
impl Sync for ManagedDirectory
impl Unpin for ManagedDirectory
impl !UnwindSafe for ManagedDirectory
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T> Fruit for T where
T: Send + Downcast,
[src]
T: Send + Downcast,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,