[][src]Struct tantivy::directory::ManagedDirectory

pub struct ManagedDirectory { /* fields omitted */ }

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
)
[src]

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.

Trait Implementations

impl Directory for ManagedDirectory[src]

impl Clone for ManagedDirectory[src]

impl Debug for ManagedDirectory[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Fruit for T where
    T: Send + Downcast
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]