Struct cask::CaskOptions
[−]
[src]
pub struct CaskOptions { /* fields omitted */ }
Cask
configuration. Provides control over the properties and behavior of the Cask
instance.
Examples
use cask::{CaskOptions, SyncStrategy}; let cask = CaskOptions::default() .compaction_check_frequency(1200) .sync(SyncStrategy::Never) .max_file_size(1024 * 1024 * 1024) .open("cask.db") .unwrap();
Methods
impl CaskOptions
[src]
fn new() -> CaskOptions
Generates the base configuration for opening a Cask
, from which configuration methods can
be chained.
fn sync(&mut self, sync: SyncStrategy) -> &mut CaskOptions
Sets the strategy used to synchronize writes to disk. Defaults to
SyncStrategy::Interval(1000)
.
fn max_file_size(&mut self, max_file_size: usize) -> &mut CaskOptions
Sets the maximum file size. Defaults to 2GB
.
fn file_pool_size(&mut self, file_pool_size: usize) -> &mut CaskOptions
Sets the maximum size of the file descriptor cache. Defaults to 2048
.
fn compaction(&mut self, compaction: bool) -> &mut CaskOptions
Enable or disable background compaction. Defaults to true
.
fn create(&mut self, create: bool) -> &mut CaskOptions
Create Cask
if it doesn't exist. Defaults to true
.
fn compaction_check_frequency(
&mut self,
compaction_check_frequency: u64
) -> &mut CaskOptions
&mut self,
compaction_check_frequency: u64
) -> &mut CaskOptions
Sets the frequency of compaction, in seconds. Defaults to 3600
.
fn compaction_window(&mut self, start: usize, end: usize) -> &mut CaskOptions
Sets the time window during which compaction can run. Defaults to [0, 23]
.
fn fragmentation_trigger(
&mut self,
fragmentation_trigger: f64
) -> &mut CaskOptions
&mut self,
fragmentation_trigger: f64
) -> &mut CaskOptions
Sets the ratio of dead entries to total entries in a file that will trigger compaction.
Defaults to 0.6
.
fn dead_bytes_trigger(&mut self, dead_bytes_trigger: u64) -> &mut CaskOptions
Sets the minimum amount of data occupied by dead entries in a single file that will trigger
compaction. Defaults to 512MB
.
fn fragmentation_threshold(
&mut self,
fragmentation_threshold: f64
) -> &mut CaskOptions
&mut self,
fragmentation_threshold: f64
) -> &mut CaskOptions
Sets the ratio of dead entries to total entries in a file that will cause it to be included
in a compaction. Defaults to 0.4
.
fn dead_bytes_threshold(
&mut self,
dead_bytes_threshold: u64
) -> &mut CaskOptions
&mut self,
dead_bytes_threshold: u64
) -> &mut CaskOptions
Sets the minimum amount of data occupied by dead entries in a single file that will cause it
to be included in a compaction. Defaults to 128MB
.
fn small_file_threshold(
&mut self,
small_file_threshold: u64
) -> &mut CaskOptions
&mut self,
small_file_threshold: u64
) -> &mut CaskOptions
Sets the minimum size a file must have to be excluded from compaction. Defaults to 10MB
.
fn open(&self, path: &str) -> Result<Cask>
Opens/creates a Cask
at path
.
Trait Implementations
impl Clone for CaskOptions
[src]
fn clone(&self) -> CaskOptions
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Default for CaskOptions
[src]
fn default() -> CaskOptions
Returns the "default value" for a type. Read more