Class: Synapse::EventStore::Mongo::CursorDomainEventStream
- Inherits:
-
Domain::DomainEventStream
- Object
- Domain::DomainEventStream
- Synapse::EventStore::Mongo::CursorDomainEventStream
- Defined in:
- lib/synapse/event_store/mongo/cursor_event_stream.rb
Overview
TODO Document me
Instance Method Summary collapse
- #end? ⇒ Boolean
- #initialize(storage_strategy, cursor, last_snapshot_commit, aggregate_id) ⇒ undefined constructor
- #next_event ⇒ DomainEventMessage
- #peek ⇒ DomainEventMessage
Constructor Details
#initialize(storage_strategy, cursor, last_snapshot_commit, aggregate_id) ⇒ undefined
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/synapse/event_store/mongo/cursor_event_stream.rb', line 11 def initialize(storage_strategy, cursor, last_snapshot_commit, aggregate_id) @storage_strategy = storage_strategy @cursor = cursor @aggregate_id = aggregate_id if last_snapshot_commit # Current batch is an enumerator @current_batch = last_snapshot_commit.each else @current_batch = [].each end initialize_next_event end |
Instance Method Details
#end? ⇒ Boolean
27 28 29 |
# File 'lib/synapse/event_store/mongo/cursor_event_stream.rb', line 27 def end? @next.nil? end |
#next_event ⇒ DomainEventMessage
32 33 34 35 36 |
# File 'lib/synapse/event_store/mongo/cursor_event_stream.rb', line 32 def next_event @next.tap do initialize_next_event end end |
#peek ⇒ DomainEventMessage
39 40 41 |
# File 'lib/synapse/event_store/mongo/cursor_event_stream.rb', line 39 def peek @next end |