IsolationLevel

Enum IsolationLevel 

Source
pub enum IsolationLevel {
    Default,
    ReadUncommitted,
    ReadCommitted,
    RepeatableRead,
    Snapshot,
    Serializable,
    Linearizable,
}
Expand description

Isolation level value for key OptionConnection::IsolationLevel.

Variants§

§

Default

Use database or driver default isolation level.

§

ReadUncommitted

The lowest isolation level. Dirty reads are allowed, so one transaction may see not-yet-committed changes made by others.

§

ReadCommitted

Lock-based concurrency control keeps write locks until the end of the transaction, but read locks are released as soon as a SELECT is performed. Non-repeatable reads can occur in this isolation level.

More simply put, ReadCommitted is an isolation level that guarantees that any data read is committed at the moment it is read. It simply restricts the reader from seeing any intermediate, uncommitted, ‘dirty’ reads. It makes no promise whatsoever that if the transaction re-issues the read, it will find the same data; data is free to change after it is read.

§

RepeatableRead

Lock-based concurrency control keeps read AND write locks (acquired on selection data) until the end of the transaction.

However, range-locks are not managed, so phantom reads can occur. Write skew is possible at this isolation level in some systems.

§

Snapshot

This isolation guarantees that all reads in the transaction will see a consistent snapshot of the database and the transaction should only successfully commit if no updates conflict with any concurrent updates made since that snapshot.

§

Serializable

Serializability requires read and write locks to be released only at the end of the transaction. This includes acquiring range-locks when a select query uses a ranged WHERE clause to avoid phantom reads.

§

Linearizable

The central distinction between serializability and linearizability is that serializability is a global property; a property of an entire history of operations and transactions. Linearizability is a local property; a property of a single operation/transaction.

Linearizability can be viewed as a special case of strict serializability where transactions are restricted to consist of a single operation applied to a single object.

Trait Implementations§

Source§

impl Debug for IsolationLevel

Source§

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

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

impl From<IsolationLevel> for OptionValue

Source§

fn from(value: IsolationLevel) -> Self

Converts to this type from the input type.
Source§

impl From<IsolationLevel> for String

Source§

fn from(value: IsolationLevel) -> Self

Converts to this type from the input type.

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 = 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> Allocation for T
where T: RefUnwindSafe + Send + Sync,