pub struct FileStore { /* private fields */ }Expand description
On-disk store: a real file wrapped in a fixed-size page cache.
This keeps the public FileStore name stable while introducing the 0.11.0 pager/buffer-pool
boundary via [crate::pager::PagedStore].
Implementations§
Source§impl FileStore
impl FileStore
pub fn new(file: File) -> Self
Sourcepub fn open_locked(
path: impl AsRef<Path>,
mode: OpenMode,
) -> Result<Self, DbError>
pub fn open_locked( path: impl AsRef<Path>, mode: OpenMode, ) -> Result<Self, DbError>
Open a file store and acquire the process-level lock for the database path.
Locking policy (cross-process):
ReadWrite: takes an exclusive advisory lock on the sidecar file<db_path>.writer.lock(fail-fast; does not block indefinitely).ReadOnly: opens the database read-only and takes a shared advisory lock on the same sidecar file. This prevents new writers from opening while readers are active.
This excludes concurrent writers, but does not prevent read-only opens while a writer is active. Callers that require stronger coordination should implement it at a higher layer.
Trait Implementations§
Source§impl Store for FileStore
impl Store for FileStore
fn len(&self) -> Result<u64, DbError>
fn read_exact_at(&mut self, offset: u64, buf: &mut [u8]) -> Result<(), DbError>
fn write_all_at(&mut self, offset: u64, buf: &[u8]) -> Result<(), DbError>
fn sync(&mut self) -> Result<(), DbError>
Source§fn truncate(&mut self, len: u64) -> Result<(), DbError>
fn truncate(&mut self, len: u64) -> Result<(), DbError>
Shrink or grow the logical file to
len bytes (used for crash recovery truncation).fn is_empty(&self) -> Result<bool, DbError>
Auto Trait Implementations§
impl Freeze for FileStore
impl RefUnwindSafe for FileStore
impl Send for FileStore
impl Sync for FileStore
impl Unpin for FileStore
impl UnsafeUnpin for FileStore
impl UnwindSafe for FileStore
Blanket Implementations§
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
Mutably borrows from an owned value. Read more