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: DurabilityDurability for this transaction.
read_committed: boolUse read-committed isolation.
read_uncommitted: boolUse read-uncommitted isolation (dirty reads).
read_only: boolThe transaction is read-only.
no_wait: boolDon’t wait for locks (fail immediately if lock unavailable).
lock_timeout_ms: u64Lock timeout in milliseconds (0 = use environment default).
txn_timeout_ms: u64Transaction timeout in milliseconds (0 = no timeout).
serializable_isolation: boolUse serializable (repeatable-read) isolation. Read locks are retained through commit/abort.
importunate: boolImportunate transactions can steal locks from other lockers rather than waiting.
local_write: boolWrites stay local (used on read-only replicas for local modifications that are not replicated).
Implementations§
Source§impl TransactionConfig
impl TransactionConfig
Sourcepub fn set_durability(&mut self, durability: Durability) -> &mut Self
pub fn set_durability(&mut self, durability: Durability) -> &mut Self
Sets the durability for this transaction.
Sourcepub fn set_read_committed(&mut self, read_committed: bool) -> &mut Self
pub fn set_read_committed(&mut self, read_committed: bool) -> &mut Self
Sets read-committed isolation.
Sourcepub fn set_read_uncommitted(&mut self, read_uncommitted: bool) -> &mut Self
pub fn set_read_uncommitted(&mut self, read_uncommitted: bool) -> &mut Self
Sets read-uncommitted isolation.
Sourcepub fn set_read_only(&mut self, read_only: bool) -> &mut Self
pub fn set_read_only(&mut self, read_only: bool) -> &mut Self
Sets whether the transaction is read-only.
Sourcepub fn set_no_wait(&mut self, no_wait: bool) -> &mut Self
pub fn set_no_wait(&mut self, no_wait: bool) -> &mut Self
Sets whether to fail immediately if a lock is unavailable.
Sourcepub fn set_lock_timeout_ms(&mut self, ms: u64) -> &mut Self
pub fn set_lock_timeout_ms(&mut self, ms: u64) -> &mut Self
Sets the lock timeout in milliseconds (0 = use environment default).
Sourcepub fn set_txn_timeout_ms(&mut self, ms: u64) -> &mut Self
pub fn set_txn_timeout_ms(&mut self, ms: u64) -> &mut Self
Sets the transaction timeout in milliseconds (0 = no timeout).
Sourcepub fn set_serializable_isolation(&mut self, v: bool) -> &mut Self
pub fn set_serializable_isolation(&mut self, v: bool) -> &mut Self
Sets serializable isolation (read locks retained through commit).
Sourcepub fn set_importunate(&mut self, v: bool) -> &mut Self
pub fn set_importunate(&mut self, v: bool) -> &mut Self
Sets importunate mode (steal locks rather than wait).
Sourcepub fn set_local_write(&mut self, v: bool) -> &mut Self
pub fn set_local_write(&mut self, v: bool) -> &mut Self
Sets local-write mode (writes not replicated).
Sourcepub fn with_durability(self, durability: Durability) -> Self
pub fn with_durability(self, durability: Durability) -> Self
Builder-style method to set durability.
Sourcepub fn with_read_committed(self, read_committed: bool) -> Self
pub fn with_read_committed(self, read_committed: bool) -> Self
Builder-style method to set read_committed.
Sourcepub fn with_read_uncommitted(self, read_uncommitted: bool) -> Self
pub fn with_read_uncommitted(self, read_uncommitted: bool) -> Self
Builder-style method to set read_uncommitted.
Sourcepub fn with_read_only(self, read_only: bool) -> Self
pub fn with_read_only(self, read_only: bool) -> Self
Builder-style method to set read_only.
Sourcepub fn with_no_wait(self, no_wait: bool) -> Self
pub fn with_no_wait(self, no_wait: bool) -> Self
Builder-style method to set no_wait.
Sourcepub fn with_lock_timeout_ms(self, ms: u64) -> Self
pub fn with_lock_timeout_ms(self, ms: u64) -> Self
Builder-style method to set lock timeout.
Sourcepub fn with_txn_timeout_ms(self, ms: u64) -> Self
pub fn with_txn_timeout_ms(self, ms: u64) -> Self
Builder-style method to set transaction timeout.
Sourcepub fn with_serializable_isolation(self, v: bool) -> Self
pub fn with_serializable_isolation(self, v: bool) -> Self
Builder-style method to set serializable isolation.
Sourcepub fn with_importunate(self, v: bool) -> Self
pub fn with_importunate(self, v: bool) -> Self
Builder-style method to set importunate mode.
Sourcepub fn with_local_write(self, v: bool) -> Self
pub fn with_local_write(self, v: bool) -> Self
Builder-style method to set local-write mode.
Sourcepub fn read_committed() -> Self
pub fn read_committed() -> Self
Creates a TransactionConfig for read-committed isolation.
Sourcepub fn read_uncommitted() -> Self
pub fn read_uncommitted() -> Self
Creates a TransactionConfig for read-uncommitted isolation.
Trait Implementations§
Source§impl Clone for TransactionConfig
impl Clone for TransactionConfig
Source§fn clone(&self) -> TransactionConfig
fn clone(&self) -> TransactionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransactionConfig
impl Debug for TransactionConfig
Source§impl Default for TransactionConfig
impl Default for TransactionConfig
impl Eq for TransactionConfig
Source§impl PartialEq for TransactionConfig
impl PartialEq for TransactionConfig
Source§fn eq(&self, other: &TransactionConfig) -> bool
fn eq(&self, other: &TransactionConfig) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TransactionConfig
Auto Trait Implementations§
impl Freeze for TransactionConfig
impl RefUnwindSafe for TransactionConfig
impl Send for TransactionConfig
impl Sync for TransactionConfig
impl Unpin for TransactionConfig
impl UnsafeUnpin for TransactionConfig
impl UnwindSafe for TransactionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.