pub struct FileStore { /* private fields */ }Expand description
A file-backed WalStore: the default storage for Wal::open.
All reads and writes are positioned (pread/pwrite on Unix, seek_read/
seek_write on Windows), so concurrent appenders writing to disjoint offsets
never contend on a shared file cursor, and a recovery read never disturbs an
append. sync issues the platform’s true durability
barrier: fdatasync on Linux, FlushFileBuffers on Windows, and
fcntl(F_FULLFSYNC) on macOS — the last because macOS’s fsync does not
flush the drive’s write cache.
Implementations§
Source§impl FileStore
impl FileStore
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open the file at path, creating it if it does not exist.
The store does not interpret the file’s contents — it does not look for a
torn tail or validate records. That is Wal::open’s
job, which scans on open and truncates any incomplete trailing record.
§Errors
Returns WalError::Io if the file cannot be opened (for example a
missing parent directory or insufficient permissions).
Trait Implementations§
Source§impl WalStore for FileStore
impl WalStore for FileStore
Source§fn write_at(&self, offset: u64, bytes: &[u8]) -> Result<()>
fn write_at(&self, offset: u64, bytes: &[u8]) -> Result<()>
bytes at byte offset, growing the store and zero-filling any
gap if offset is beyond the current end.