Skip to main content

TransactionConfig

Struct TransactionConfig 

Source
pub struct TransactionConfig {
    pub durability: Durability,
    pub read_committed: bool,
    pub read_uncommitted: bool,
    pub read_only: bool,
    pub no_wait: bool,
    pub lock_timeout_ms: u64,
    pub txn_timeout_ms: u64,
    pub serializable_isolation: bool,
    pub importunate: bool,
    pub local_write: bool,
}
Expand description

Configuration for transactions.

Specifies the configuration parameters used when beginning a transaction.

Fields§

§durability: Durability

Durability for this transaction.

§read_committed: bool

Use read-committed isolation.

§read_uncommitted: bool

Use read-uncommitted isolation (dirty reads).

§read_only: bool

The transaction is read-only.

§no_wait: bool

Don’t wait for locks (fail immediately if lock unavailable).

§lock_timeout_ms: u64

Lock timeout in milliseconds (0 = use environment default).

§txn_timeout_ms: u64

Transaction timeout in milliseconds (0 = no timeout).

§serializable_isolation: bool

Use serializable (repeatable-read) isolation. Read locks are retained through commit/abort.

§importunate: bool

Importunate transactions can steal locks from other lockers rather than waiting.

§local_write: bool

Writes stay local (used on read-only replicas for local modifications that are not replicated).

Implementations§

Source§

impl TransactionConfig

Source

pub fn new() -> Self

Creates a new TransactionConfig with default settings.

Source

pub fn set_durability(&mut self, durability: Durability) -> &mut Self

Sets the durability for this transaction.

Source

pub fn set_read_committed(&mut self, read_committed: bool) -> &mut Self

Sets read-committed isolation.

Source

pub fn set_read_uncommitted(&mut self, read_uncommitted: bool) -> &mut Self

Sets read-uncommitted isolation.

Source

pub fn set_read_only(&mut self, read_only: bool) -> &mut Self

Sets whether the transaction is read-only.

Source

pub fn set_no_wait(&mut self, no_wait: bool) -> &mut Self

Sets whether to fail immediately if a lock is unavailable.

Source

pub fn set_lock_timeout_ms(&mut self, ms: u64) -> &mut Self

Sets the lock timeout in milliseconds (0 = use environment default).

Source

pub fn set_txn_timeout_ms(&mut self, ms: u64) -> &mut Self

Sets the transaction timeout in milliseconds (0 = no timeout).

Source

pub fn set_serializable_isolation(&mut self, v: bool) -> &mut Self

Sets serializable isolation (read locks retained through commit).

Source

pub fn set_importunate(&mut self, v: bool) -> &mut Self

Sets importunate mode (steal locks rather than wait).

Source

pub fn set_local_write(&mut self, v: bool) -> &mut Self

Sets local-write mode (writes not replicated).

Source

pub fn with_durability(self, durability: Durability) -> Self

Builder-style method to set durability.

Source

pub fn with_read_committed(self, read_committed: bool) -> Self

Builder-style method to set read_committed.

Source

pub fn with_read_uncommitted(self, read_uncommitted: bool) -> Self

Builder-style method to set read_uncommitted.

Source

pub fn with_read_only(self, read_only: bool) -> Self

Builder-style method to set read_only.

Source

pub fn with_no_wait(self, no_wait: bool) -> Self

Builder-style method to set no_wait.

Source

pub fn with_lock_timeout_ms(self, ms: u64) -> Self

Builder-style method to set lock timeout.

Source

pub fn with_txn_timeout_ms(self, ms: u64) -> Self

Builder-style method to set transaction timeout.

Source

pub fn with_serializable_isolation(self, v: bool) -> Self

Builder-style method to set serializable isolation.

Source

pub fn with_importunate(self, v: bool) -> Self

Builder-style method to set importunate mode.

Source

pub fn with_local_write(self, v: bool) -> Self

Builder-style method to set local-write mode.

Source

pub fn read_committed() -> Self

Creates a TransactionConfig for read-committed isolation.

Source

pub fn read_uncommitted() -> Self

Creates a TransactionConfig for read-uncommitted isolation.

Source

pub fn read_only() -> Self

Creates a TransactionConfig for read-only transactions.

Trait Implementations§

Source§

impl Clone for TransactionConfig

Source§

fn clone(&self) -> TransactionConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TransactionConfig

Source§

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

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

impl Default for TransactionConfig

Source§

fn default() -> Self

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

impl Eq for TransactionConfig

Source§

impl PartialEq for TransactionConfig

Source§

fn eq(&self, other: &TransactionConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TransactionConfig

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more