Sha256: 4b4029ec8ae83fbbb096eabb3e4f260b75a74fd1fdd2faf5a8603b98f896db0a
Contents?: true
Size: 1.41 KB
Versions: 24
Compression:
Stored size: 1.41 KB
Contents
module Lev class TransactionIsolation def initialize(symbol) raise Lev.configuration.illegal_argument_error, "Invalid isolation symbol" if !@@symbols_to_isolation_levels.has_key?(symbol) @symbol = symbol end def self.no_transaction; new(:no_transaction); end def self.read_uncommitted; new(:read_uncommitted); end def self.read_committed; new(:read_committed); end def self.repeatable_read; new(:repeatable_read); end def self.serializable; new(:serializable); end def replace_if_more_isolated(other_transaction_isolation) if other_transaction_isolation.isolation_level > self.isolation_level self.symbol = other_transaction_isolation.symbol end self end def weaker_than(other) self.isolation_level < other.isolation_level end def self.mysql_default # MySQL default per https://blog.engineyard.com/2010/a-gentle-introduction-to-isolation-levels repeatable_read end def ==(other) self.symbol == other.symbol end def eql?(other) self == other end attr_reader :symbol protected def isolation_level @@symbols_to_isolation_levels[symbol] end @@symbols_to_isolation_levels = { no_transaction: 0, read_uncommitted: 1, read_committed: 2, repeatable_read: 3, serializable: 4 } attr_writer :symbol end end
Version data entries
24 entries across 24 versions & 1 rubygems
Version | Path |
---|---|
lev-4.3.1 | lib/lev/transaction_isolation.rb |
lev-4.3.0 | lib/lev/transaction_isolation.rb |
lev-4.2.0 | lib/lev/transaction_isolation.rb |
lev-4.1.0 | lib/lev/transaction_isolation.rb |