class Lev::TransactionIsolation

Attributes

symbol[RW]

Public Class Methods

mysql_default() click to toggle source
# File lib/lev/transaction_isolation.rb, line 27
def self.mysql_default
  # MySQL default per https://blog.engineyard.com/2010/a-gentle-introduction-to-isolation-levels
  repeatable_read
end
new(symbol) click to toggle source
# File lib/lev/transaction_isolation.rb, line 4
def initialize(symbol)
  raise Lev.configuration.illegal_argument_error, "Invalid isolation symbol" if !@@symbols_to_isolation_levels.has_key?(symbol)
  @symbol = symbol
end
no_transaction() click to toggle source
# File lib/lev/transaction_isolation.rb, line 9
def self.no_transaction;   new(:no_transaction);   end
read_committed() click to toggle source
# File lib/lev/transaction_isolation.rb, line 11
def self.read_committed;   new(:read_committed);   end
read_uncommitted() click to toggle source
# File lib/lev/transaction_isolation.rb, line 10
def self.read_uncommitted; new(:read_uncommitted); end
repeatable_read() click to toggle source
# File lib/lev/transaction_isolation.rb, line 12
def self.repeatable_read;  new(:repeatable_read);  end
serializable() click to toggle source
# File lib/lev/transaction_isolation.rb, line 13
def self.serializable;     new(:serializable);     end

Public Instance Methods

==(other) click to toggle source
# File lib/lev/transaction_isolation.rb, line 32
def ==(other)
  self.symbol == other.symbol
end
eql?(other) click to toggle source
# File lib/lev/transaction_isolation.rb, line 36
def eql?(other)
  self == other
end
replace_if_more_isolated(other_transaction_isolation) click to toggle source
# File lib/lev/transaction_isolation.rb, line 16
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
weaker_than(other) click to toggle source
# File lib/lev/transaction_isolation.rb, line 23
def weaker_than(other)
  self.isolation_level < other.isolation_level
end

Protected Instance Methods

isolation_level() click to toggle source
# File lib/lev/transaction_isolation.rb, line 44
def isolation_level
  @@symbols_to_isolation_levels[symbol]
end