Skip to main content

Module platform

Module platform 

Source
Expand description

Platform layer (L0).

This module owns the file-system primitives the pager and WAL build on: opening a database file, positioned reads and writes at fixed page boundaries, length queries, truncation, removal, and the durability primitive FileHandle::sync_data.

§unsafe policy

Power-of-ten Rule 8 confines unsafe to this submodule (and to libobj). All positioned-I/O and durability calls go through the rustix crate, which provides audited safe wrappers. The cross-process locking submodule lock reaches for libc::fcntl / LockFileEx directly because rustix does not expose POSIX OFD-lock variants; every unsafe block in that submodule carries a // SAFETY: comment per Rule 8. This mod.rs itself contains no unsafe blocks and is #![deny(unsafe_code)]; the lint is scoped to the file rather than the module tree so the lock submodule can re-introduce its (audited) unsafe blocks.

Re-exports§

pub use crate::platform::lock::ReaderLock;
pub use crate::platform::lock::WriterLock;

Modules§

lock
Cross-process byte-range file locking.

Structs§

FileHandle
A handle to a database file capable of positioned reads and writes at page boundaries.

Enums§

SyncMode
Durability mode for FileHandle::sync_data.

Traits§

FileBackend
File-backend abstraction the pager and WAL build on.

Functions§

remove_file_if_exists
Delete the file at path if it exists.