Class: Sequent::Util::DryRun::EventStoreProxy
- Inherits:
-
Object
- Object
- Sequent::Util::DryRun::EventStoreProxy
- Defined in:
- lib/sequent/util/dry_run.rb
Overview
Proxies the given EventStore implements commit_events that instead of publish and store just publishes the events.
Instance Attribute Summary collapse
-
#command_with_events ⇒ Object
readonly
Returns the value of attribute command_with_events.
-
#event_store ⇒ Object
readonly
Returns the value of attribute event_store.
Instance Method Summary collapse
- #commit_events(command, streams_with_events) ⇒ Object
-
#initialize(result, event_store) ⇒ EventStoreProxy
constructor
A new instance of EventStoreProxy.
- #update_unique_keys(event_streams) ⇒ Object
Constructor Details
#initialize(result, event_store) ⇒ EventStoreProxy
Returns a new instance of EventStoreProxy.
45 46 47 48 49 |
# File 'lib/sequent/util/dry_run.rb', line 45 def initialize(result, event_store) @event_store = event_store @command_with_events = {} @result = result end |
Instance Attribute Details
#command_with_events ⇒ Object (readonly)
Returns the value of attribute command_with_events.
33 34 35 |
# File 'lib/sequent/util/dry_run.rb', line 33 def command_with_events @command_with_events end |
#event_store ⇒ Object (readonly)
Returns the value of attribute event_store.
33 34 35 |
# File 'lib/sequent/util/dry_run.rb', line 33 def event_store @event_store end |
Instance Method Details
#commit_events(command, streams_with_events) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/sequent/util/dry_run.rb', line 51 def commit_events(command, streams_with_events) Sequent.configuration.event_publisher.publish_events(streams_with_events.flat_map { |_, events| events }) new_events = streams_with_events.flat_map { |_, events| events } @result.published_command_with_events(command, new_events) end |
#update_unique_keys(event_streams) ⇒ Object
58 59 60 |
# File 'lib/sequent/util/dry_run.rb', line 58 def update_unique_keys(event_streams) # no-op end |