Struct foyer::DirectFileDeviceOptionsBuilder
source · pub struct DirectFileDeviceOptionsBuilder { /* private fields */ }Expand description
DirectFileDeviceOptionsBuilder is used to build the options for the direct fs device.
The direct fs device uses a directory in a file system to store the data of disk cache.
It uses direct I/O to reduce buffer copy and page cache pollution if supported.
Implementations§
source§impl DirectFileDeviceOptionsBuilder
impl DirectFileDeviceOptionsBuilder
sourcepub fn new(path: impl AsRef<Path>) -> DirectFileDeviceOptionsBuilder
pub fn new(path: impl AsRef<Path>) -> DirectFileDeviceOptionsBuilder
Use the given file path as the direct file device path.
sourcepub fn with_capacity(self, capacity: usize) -> DirectFileDeviceOptionsBuilder
pub fn with_capacity(self, capacity: usize) -> DirectFileDeviceOptionsBuilder
Set the capacity of the direct file device.
The given capacity may be modified on build for alignment.
The direct file device uses 80% of the current free disk space by default.
sourcepub fn with_region_size(
self,
region_size: usize,
) -> DirectFileDeviceOptionsBuilder
pub fn with_region_size( self, region_size: usize, ) -> DirectFileDeviceOptionsBuilder
Set the file size of the direct file device.
The given file size may be modified on build for alignment.
The serialized entry size (with extra metadata) must be equal to or smaller than the file size.
sourcepub fn build(self) -> DirectFileDeviceOptions
pub fn build(self) -> DirectFileDeviceOptions
Build the options of the direct file device with the given arguments.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DirectFileDeviceOptionsBuilder
impl RefUnwindSafe for DirectFileDeviceOptionsBuilder
impl Send for DirectFileDeviceOptionsBuilder
impl Sync for DirectFileDeviceOptionsBuilder
impl Unpin for DirectFileDeviceOptionsBuilder
impl UnwindSafe for DirectFileDeviceOptionsBuilder
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 more