Struct Config

Source
pub struct Config { /* private fields */ }
Expand description

Global keyspace configuration

Implementations§

Source§

impl Config

Source

pub fn new<P: AsRef<Path>>(path: P) -> Self

Creates a new configuration

Source

pub fn manual_journal_persist(self, flag: bool) -> Self

If false, write batches or transactions automatically flush data to the operating system.

Default = false

Set to true to handle persistence manually, e.g. manually using PersistMode::SyncData for ACID transactions.

Source

pub fn flush_workers(self, n: usize) -> Self

Sets the amount of flush workers

Default = # CPU cores

Source

pub fn compaction_workers(self, n: usize) -> Self

Sets the amount of compaction workers

Default = # CPU cores

Source

pub fn max_open_files(self, n: usize) -> Self

Sets the upper limit for open file descriptors.

§Panics

Panics if n < 2.

Source

pub fn block_cache(self, block_cache: Arc<BlockCache>) -> Self

Sets the block cache.

Defaults to a block cache with 16 MiB of capacity shared between all partitions inside this keyspace.

Source

pub fn blob_cache(self, blob_cache: Arc<BlobCache>) -> Self

Sets the blob cache.

Defaults to a block cache with 16 MiB of capacity shared between all partitions inside this keyspace.

Source

pub fn max_journaling_size(self, bytes: u64) -> Self

Max size of all journals in bytes.

Default = 512 MiB

§Panics

Panics if bytes < 24 MiB.

This option should be at least 24 MiB, as one journal takes up at least 16 MiB, so anything less will immediately stall the system.

Same as max_total_wal_size in RocksDB.

Source

pub fn max_write_buffer_size(self, bytes: u64) -> Self

Max size of all memtables in bytes.

Similar to db_write_buffer_size in RocksDB, however it is disabled by default in RocksDB.

Set to u64::MAX to disable it.

Default = 64 MiB

§Panics

Panics if bytes < 1 MiB.

Source

pub fn fsync_ms(self, ms: Option<u16>) -> Self

If Some, starts an fsync thread that asynchronously persists data to disk (using fsync).

Default = off

§Panics

Panics if ms is 0.

Source

pub fn open(self) -> Result<Keyspace>

Opens a keyspace using the config.

§Errors

Will return Err if an IO error occurs.

Source

pub fn open_transactional(self) -> Result<TxKeyspace>

Opens a transactional keyspace using the config.

§Errors

Will return Err if an IO error occurs.

Source

pub fn temporary(self, flag: bool) -> Self

Sets the Keyspace to clean upon drop.

§Examples
let keyspace = Config::new(&folder).temporary(true).open()?;

assert!(folder.try_exists()?);
drop(keyspace);
assert!(!folder.try_exists()?);

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 Default for Config

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.