Struct tantivy::directory::MmapDirectory [−][src]
pub struct MmapDirectory { /* fields omitted */ }
Directory storing data in files, read via mmap.
The Mmap object are cached to limit the system calls.
Methods
impl MmapDirectory
[src]
impl MmapDirectory
pub fn create_from_tempdir() -> Result<MmapDirectory>
[src]
pub fn create_from_tempdir() -> Result<MmapDirectory>
Creates a new MmapDirectory in a temporary directory.
This is mostly useful to test the MmapDirectory itself. For your unit tests, prefer the RAMDirectory.
pub fn open<P: AsRef<Path>>(
directory_path: P
) -> Result<MmapDirectory, OpenDirectoryError>
[src]
pub fn open<P: AsRef<Path>>(
directory_path: P
) -> Result<MmapDirectory, OpenDirectoryError>
Opens a MmapDirectory in a directory.
Returns an error if the directory_path
does not
exist or if it is not a directory.
pub fn get_cache_info(&mut self) -> CacheInfo
[src]
pub fn get_cache_info(&mut self) -> CacheInfo
Returns some statistical information about the Mmap cache.
The MmapDirectory
embeds a MmapDirectory
to avoid multiplying the mmap
system calls.
Trait Implementations
impl Clone for MmapDirectory
[src]
impl Clone for MmapDirectory
fn clone(&self) -> MmapDirectory
[src]
fn clone(&self) -> MmapDirectory
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for MmapDirectory
[src]
impl Debug for MmapDirectory
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Directory for MmapDirectory
[src]
impl Directory for MmapDirectory
fn open_read(&self, path: &Path) -> Result<ReadOnlySource, OpenReadError>
[src]
fn open_read(&self, path: &Path) -> Result<ReadOnlySource, OpenReadError>
Opens a virtual file for read. Read more
fn open_write(&mut self, path: &Path) -> Result<WritePtr, OpenWriteError>
[src]
fn open_write(&mut self, path: &Path) -> Result<WritePtr, OpenWriteError>
Opens a writer for the virtual file associated with a Path. Read more
fn delete(&self, path: &Path) -> Result<(), DeleteError>
[src]
fn delete(&self, path: &Path) -> Result<(), DeleteError>
Any entry associated to the path in the mmap will be removed before the file is deleted.
fn exists(&self, path: &Path) -> bool
[src]
fn exists(&self, path: &Path) -> bool
Returns true iff the file exists
fn atomic_read(&self, path: &Path) -> Result<Vec<u8>, OpenReadError>
[src]
fn atomic_read(&self, path: &Path) -> Result<Vec<u8>, OpenReadError>
Reads the full content file that has been written using atomic_write. Read more
fn atomic_write(&mut self, path: &Path, data: &[u8]) -> Result<()>
[src]
fn atomic_write(&mut self, path: &Path, data: &[u8]) -> Result<()>
Atomically replace the content of a file with data. Read more
ⓘImportant traits for Box<R>fn box_clone(&self) -> Box<Directory>
[src]
fn box_clone(&self) -> Box<Directory>
Clones the directory and boxes the clone
Auto Trait Implementations
impl Send for MmapDirectory
impl Send for MmapDirectory
impl Sync for MmapDirectory
impl Sync for MmapDirectory