Method: Evoc::TxStore#initialize

Defined in:
lib/evoc/tx_store.rb

#initialize(path: nil, case_id: nil, granularity: 'mixed') ⇒ TxStore

Returns a new instance of TxStore.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/evoc/tx_store.rb', line 10

def initialize(path: nil,case_id: nil, granularity: 'mixed')
  @txes = []
  @items = Evoc::Env::GOOGLE_HASH ? GoogleHashSparseIntToRuby.new : Hash.new
  # keeps track of each txs location
  # in the @txes array using the tx.index variable
  @tx_index_mapping = Evoc::Env::GOOGLE_HASH ? GoogleHashSparseIntToInt.new : Hash.new
  # keeps a dictionary of item ids and their full filename
  # populated when first importing the json file
  @name_2_int = Evoc::Env::GOOGLE_HASH ? GoogleHashSparseRubyToInt.new : Hash.new  
  @int_2_name = Evoc::Env::GOOGLE_HASH ? GoogleHashSparseIntToRuby.new : Hash.new
  if !path.nil?
    load_transactions(path: path, granularity: granularity)
  end

  # Initialize class variables
  @@case_id ||= case_id
end