Module: Sequent::Core::Persistors::ReplayOptimizedPostgresPersistor::InMemoryStruct

Defined in:
lib/sequent/core/persistors/replay_optimized_postgres_persistor.rb

Overview

We create a struct on the fly to represent an in-memory record.

Since the replay happens in memory we implement the ==, eql? and hash methods to point to the same object. A record is the same if and only if they point to the same object. These methods are necessary since we use Set instead of [].

Also basing equality on object identity is more consistent with ActiveRecord, which is the implementation used during normal (non-optimized) replay.

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



71
72
73
# File 'lib/sequent/core/persistors/replay_optimized_postgres_persistor.rb', line 71

def ==(other)
  equal?(other)
end

#eql?(other) ⇒ Boolean

Returns:



74
75
76
# File 'lib/sequent/core/persistors/replay_optimized_postgres_persistor.rb', line 74

def eql?(other)
  equal?(other)
end

#hashObject



77
78
79
# File 'lib/sequent/core/persistors/replay_optimized_postgres_persistor.rb', line 77

def hash
  object_id.hash
end