pub struct DirectFileRing { /* private fields */ }Expand description
Non-mmap positioned-I/O ring with page-cache bypass.
Implementations§
Source§impl DirectFileRing
impl DirectFileRing
Sourcepub fn create(
base_path: impl AsRef<Path>,
capacity: usize,
) -> Result<Self, DirectFileError>
pub fn create( base_path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, DirectFileError>
Obtain the ring at base_path over three files:
{base}.directfile.data.bin (the slot array, unbuffered),
{base}.directfile.head.bin (head counter, MMF),
{base}.directfile.tail.bin (tail counter, MMF).
Initializes them only where they do not yet exist, and
otherwise attaches with queued slots and both counters in
place. The data file carries no header, so capacity is checked
against its exact byte size; a different capacity is a
LayoutMismatch. reset reinitializes.
Sourcepub fn reset(
base_path: impl AsRef<Path>,
capacity: usize,
) -> Result<Self, DirectFileError>
pub fn reset( base_path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, DirectFileError>
Truncate the three files at base_path and initialize an
empty ring, discarding queued slots live peers hold. For a
caller that knows it owns the base path.
Sourcepub fn open(
base_path: impl AsRef<Path>,
expected_capacity: usize,
) -> Result<Self, DirectFileError>
pub fn open( base_path: impl AsRef<Path>, expected_capacity: usize, ) -> Result<Self, DirectFileError>
Open an existing ring at base_path (a second process).
Trait Implementations§
Source§impl Drop for DirectFileRing
impl Drop for DirectFileRing
impl Send for DirectFileRing
impl Sync for DirectFileRing
Auto Trait Implementations§
impl Freeze for DirectFileRing
impl RefUnwindSafe for DirectFileRing
impl Unpin for DirectFileRing
impl UnsafeUnpin for DirectFileRing
impl UnwindSafe for DirectFileRing
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