Skip to main content

OptimisticTransactionDBOptions

Struct OptimisticTransactionDBOptions 

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

Options for opening an OptimisticTransactionDB.

These control conflict validation only. Everything else about the database still comes from Options, which is passed alongside these to the open call.

Implementations§

Source§

impl OptimisticTransactionDBOptions

Source

pub fn new() -> OptimisticTransactionDBOptions

Source

pub fn set_validate_policy(&mut self, policy: OccValidationPolicy)

Specifies how transactions are checked for write conflicts at commit.

Default: OccValidationPolicy::ValidateParallel.

Source

pub fn get_validate_policy(&self) -> Option<OccValidationPolicy>

The validation policy set by Self::set_validate_policy.

OccValidationPolicy covers every policy RocksDB defines today, so None only shows up if a future release adds one.

Source

pub fn set_occ_lock_buckets(&mut self, num_buckets: u32)

Specifies how many striped mutex locks to allocate for validating transactions.

Only used when the validation policy is OccValidationPolicy::ValidateParallel and no pool was supplied through Self::set_shared_lock_buckets. A larger count potentially reduces contention but uses more memory.

Default: 1048576 (1 << 20).

Source

pub fn get_occ_lock_buckets(&self) -> u32

Returns the value of the occ_lock_buckets option.

Source

pub fn set_shared_lock_buckets(&mut self, buckets: &OccLockBuckets)

Validates against buckets instead of a pool private to this database.

Give the same OccLockBuckets to several databases and they share one set of locks, which bounds the total memory spent on validation. Ignored unless the validation policy is OccValidationPolicy::ValidateParallel, and it overrides Self::set_occ_lock_buckets when set.

These options take their own reference to the pool, so buckets may be dropped as soon as this returns.

Trait Implementations§

Source§

impl Default for OptimisticTransactionDBOptions

Source§

fn default() -> Self

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

impl Drop for OptimisticTransactionDBOptions

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for OptimisticTransactionDBOptions

Source§

impl Sync for OptimisticTransactionDBOptions

Auto Trait Implementations§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.