Class: Synapse::EventSourcing::EventSourcingRepository
- Inherits:
-
Repository::LockingRepository
- Object
- Repository
- Repository::LockingRepository
- Synapse::EventSourcing::EventSourcingRepository
- Defined in:
- lib/synapse/event_sourcing/repository.rb
Overview
Repository that initializes the state of aggregates using events read from an event store and appends changes to aggregates to an event store
Instance Attribute Summary collapse
- #aggregate_factory ⇒ AggregateFactory readonly
- #conflict_resolver ⇒ ConflictResolver
- #event_store ⇒ EventStore readonly
- #stream_decorators ⇒ Array<EventStreamDecorator> readonly
Attributes inherited from Repository::LockingRepository
Instance Method Summary collapse
-
#add_stream_decorator(stream_decorator) ⇒ undefined
Appends a stream decorator onto the end of the list of stream decorators.
- #initialize(aggregate_factory, event_store, lock_manager) ⇒ undefined constructor
Methods inherited from Repository::LockingRepository
Constructor Details
#initialize(aggregate_factory, event_store, lock_manager) ⇒ undefined
22 23 24 25 26 27 28 29 30 |
# File 'lib/synapse/event_sourcing/repository.rb', line 22 def initialize(aggregate_factory, event_store, lock_manager) super lock_manager @aggregate_factory = aggregate_factory @event_store = event_store @stream_decorators = Array.new @storage_listener = EventSourcedStorageListener.new @event_store, @lock_manager, @stream_decorators, type_identifier end |
Instance Attribute Details
#aggregate_factory ⇒ AggregateFactory (readonly)
7 8 9 |
# File 'lib/synapse/event_sourcing/repository.rb', line 7 def aggregate_factory @aggregate_factory end |
#conflict_resolver ⇒ ConflictResolver
10 11 12 |
# File 'lib/synapse/event_sourcing/repository.rb', line 10 def conflict_resolver @conflict_resolver end |
#event_store ⇒ EventStore (readonly)
13 14 15 |
# File 'lib/synapse/event_sourcing/repository.rb', line 13 def event_store @event_store end |
#stream_decorators ⇒ Array<EventStreamDecorator> (readonly)
16 17 18 |
# File 'lib/synapse/event_sourcing/repository.rb', line 16 def stream_decorators @stream_decorators end |
Instance Method Details
#add_stream_decorator(stream_decorator) ⇒ undefined
Appends a stream decorator onto the end of the list of stream decorators
36 37 38 |
# File 'lib/synapse/event_sourcing/repository.rb', line 36 def add_stream_decorator(stream_decorator) @stream_decorators.push stream_decorator end |