Module: Higgs::TransactionManager::InitOptions

Included in:
Higgs::TransactionManager
Defined in:
lib/higgs/tman.rb

Overview

options for Higgs::TransactionManager

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#read_onlyObject (readonly)

Returns the value of attribute read_only.



84
85
86
# File 'lib/higgs/tman.rb', line 84

def read_only
  @read_only
end

Instance Method Details

#init_options(options) ⇒ Object

these options are defined.

:read_only

if true then transaction is always read-only. default is false. :standby is standby mode. in standby mode, transaction is read-only and Higgs::TransactionManager#apply_journal_log is callable. if Higgs::TransactionManager#switch_to_write is called in standby mode then state of manager changes from standby mode to read-write mode.

:decode

procedure to decode data on read. if :string_only property at an entry is true then decode is not used to read the entry. default is proc{|r| r }.

:encode

procedure to encode data on write. if :string_only property at an entry is true then encode is not used to write the entry. default is proc{|w| w }.

:lock_manager

lock of a transaction and individual data. default is a new instance of Higgs::GiantLockManager.

:master_cache

read-cache for encoded string data. defauilt is a new instance of Higgs::LRUCache.

:secondary_cache

secondary read-cache for encoded string data. key of cache is always unique string. default is no effect.

:jlog_apply_dir

journal logs under the directory of this parameter is applied to storage on call of Higgs::TransactionManager#apply_journal_log



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/higgs/tman.rb', line 69

def init_options(options)
  if (options.key? :read_only) then
    @read_only = options[:read_only]
  else
    @read_only = false
  end

  @decode = options[:decode] || proc{|r| r }
  @encode = options[:encode] || proc{|w| w }
  @lock_manager = options[:lock_manager] || GiantLockManager.new
  @master_cache = options[:master_cache] || LRUCache.new
  @secondary_cache = options[:secondary_cache] || PseudoSecondaryCache.instance
  @jlog_apply_dir = options[:jlog_apply_dir] || nil
end