class DpStmMap::ObjectStore

Public Class Methods

new(stm_map) click to toggle source
# File lib/dp_stm_map/ObjectStore.rb, line 48
def initialize stm_map
  @stm_map=stm_map
end

Public Instance Methods

atomic(timeout=nil) { |object_transaction_wrapper| ... } click to toggle source
# File lib/dp_stm_map/ObjectStore.rb, line 59
def atomic timeout=nil
  @stm_map.atomic(timeout) do |stx|
    yield ObjectTransactionWrapper.new(stx)
  end
end
atomic_read() { |object_transaction_wrapper| ... } click to toggle source
# File lib/dp_stm_map/ObjectStore.rb, line 65
def atomic_read
  @stm_map.atomic_read do |stx|
    yield ObjectTransactionWrapper.new(stx)
  end
end
on_atomic() { |changes_to_object_changes changes| ... } click to toggle source
# File lib/dp_stm_map/ObjectStore.rb, line 53
def on_atomic
  @stm_map.on_atomic do |changes|
    yield changes_to_object_changes changes
  end
end
validate_atomic() { |changes_to_object_changes changes| ... } click to toggle source
# File lib/dp_stm_map/ObjectStore.rb, line 71
def validate_atomic
  @stm_map.validate_atomic do |changes|
    yield changes_to_object_changes changes
  end
end

Private Instance Methods

changes_to_object_changes(changes) click to toggle source
# File lib/dp_stm_map/ObjectStore.rb, line 80
def changes_to_object_changes changes
  changes.inject({}) {|h, (k,v)| h[string_to_domain_key(k)]=[deserialize_object(v[0]),deserialize_object(v[1])]; h}
end
deserialize_object(str) click to toggle source
# File lib/dp_stm_map/ObjectStore.rb, line 90
def deserialize_object str
  str == nil ? nil : YAML::load(str)
end
string_to_domain_key(str) click to toggle source
# File lib/dp_stm_map/ObjectStore.rb, line 85
def string_to_domain_key str
  parts=str.split(/:/)
  [parts[0].to_sym, parts[1]]
end