Struct sled::Config

source ·
pub struct Config {
    pub path: PathBuf,
    pub cache_capacity_bytes: usize,
    pub entry_cache_percent: u8,
    pub flush_every_ms: Option<usize>,
    pub zstd_compression_level: i32,
    pub tempdir_deleter: Option<Arc<TempDir>>,
}

Fields§

§path: PathBuf

The base directory for storing the database.

§cache_capacity_bytes: usize

Cache size in bytes. Default is 512mb.

§entry_cache_percent: u8

The percentage of the cache that is dedicated to the scan-resistant entry cache.

§flush_every_ms: Option<usize>

Start a background thread that flushes data to disk every few milliseconds. Defaults to every 200ms.

§zstd_compression_level: i32

The zstd compression level to use when writing data to disk. Defaults to 3.

§tempdir_deleter: Option<Arc<TempDir>>

This is only set to Some for objects created via Config::tmp, and will remove the storage directory when the final Arc drops.

Implementations§

source§

impl Config

source

pub fn new() -> Config

Returns a default Config

source

pub fn tmp() -> Result<Config>

Returns a config with the path initialized to a system temporary directory that will be deleted when this Config is dropped.

source

pub fn path<P: AsRef<Path>>(self, path: P) -> Config

Set the path of the database (builder).

source

pub fn flush_every_ms(self, to: Option<usize>) -> Self

Start a background thread that flushes data to disk every few milliseconds. Defaults to every 200ms.

source

pub fn cache_capacity_bytes(self, to: usize) -> Self

Cache size in bytes. Default is 512mb.

source

pub fn entry_cache_percent(self, to: u8) -> Self

The percentage of the cache that is dedicated to the scan-resistant entry cache.

source

pub fn zstd_compression_level(self, to: i32) -> Self

The zstd compression level to use when writing data to disk. Defaults to 3.

source

pub fn open<const INDEX_FANOUT: usize, const LEAF_FANOUT: usize, const EBR_LOCAL_GC_BUFFER_SIZE: usize>( &self ) -> Result<Db<INDEX_FANOUT, LEAF_FANOUT, EBR_LOCAL_GC_BUFFER_SIZE>>

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Config

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.