pub struct FileStorage { /* private fields */ }Expand description
A file-based storage implementation.
FileStorage provides persistent disk-based storage with two read modes:
- Traditional I/O (default): Uses buffered file reads with
BufReader - Memory-mapped I/O: Uses mmap for zero-copy reads when
config.use_mmapis true
The mmap mode includes caching and automatic invalidation on file changes, making it suitable for read-heavy workloads with large files.
Implementations§
Source§impl FileStorage
impl FileStorage
Trait Implementations§
Source§impl Debug for FileStorage
impl Debug for FileStorage
Source§impl Storage for FileStorage
impl Storage for FileStorage
Source§fn create_output(&self, name: &str) -> Result<Box<dyn StorageOutput>>
fn create_output(&self, name: &str) -> Result<Box<dyn StorageOutput>>
Create a fresh output for name, truncating any existing file.
§Concurrency
On Windows the OS holds an exclusive lock on memory-mapped
files. This method evicts the storage’s own mmap cache entry
for name before the truncate so the file lock can be
released (Issue #508). Any StorageInput previously returned
by Self::open_input for the same name must already be
dropped before another code path invokes this method —
otherwise the outstanding Arc<Mmap> clone will keep the
Windows lock alive and the OS returns ERROR_USER_MAPPED_FILE.
See Self::evict_mmap for the full lifetime contract.
Source§fn create_output_append(&self, name: &str) -> Result<Box<dyn StorageOutput>>
fn create_output_append(&self, name: &str) -> Result<Box<dyn StorageOutput>>
Open name for append, creating it if necessary.
§Concurrency
Append-mode targets (WAL, log files) are not memory-mapped in
the current codebase, so the cache eviction below is purely
defensive. If a future change starts mmap’ing one of these
files, the Windows lifecycle contract documented on
Self::evict_mmap already applies (Issue #508).
Source§fn delete_file(&self, name: &str) -> Result<()>
fn delete_file(&self, name: &str) -> Result<()>
Delete name from the storage directory.
§Concurrency
On Windows, remove_file returns ERROR_USER_MAPPED_FILE if
any process still holds an mmap for the file. This method
evicts the storage’s own cached Arc<Mmap> first to release
the lock (Issue #508). Outstanding StorageInput clones held
elsewhere keep the lock alive until they drop; the same
lifetime contract documented on Self::evict_mmap applies.
Source§fn loading_mode(&self) -> LoadingMode
fn loading_mode(&self) -> LoadingMode
Source§fn open_input(&self, name: &str) -> Result<Box<dyn StorageInput>>
fn open_input(&self, name: &str) -> Result<Box<dyn StorageInput>>
Source§fn create_temp_output(
&self,
prefix: &str,
) -> Result<(String, Box<dyn StorageOutput>)>
fn create_temp_output( &self, prefix: &str, ) -> Result<(String, Box<dyn StorageOutput>)>
Auto Trait Implementations§
impl Freeze for FileStorage
impl RefUnwindSafe for FileStorage
impl Send for FileStorage
impl Sync for FileStorage
impl Unpin for FileStorage
impl UnsafeUnpin for FileStorage
impl UnwindSafe for FileStorage
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.