Class: Synapse::EventSourcing::EventSourcingRepository

Inherits:
Repository::LockingRepository show all
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

Direct Known Subclasses

CachingEventSourcingRepository

Instance Attribute Summary collapse

Attributes inherited from Repository::LockingRepository

#lock_manager

Instance Method Summary collapse

Methods inherited from Repository::LockingRepository

#add, #load

Constructor Details

#initialize(aggregate_factory, event_store, lock_manager) ⇒ undefined

Parameters:



28
29
30
31
32
33
34
# File 'lib/synapse/event_sourcing/repository.rb', line 28

def initialize(aggregate_factory, event_store, lock_manager)
  super lock_manager

  @aggregate_factory = aggregate_factory
  @event_store = event_store
  @stream_decorators = Array.new
end

Instance Attribute Details

#aggregate_factoryAggregateFactory (readonly)

Returns:



7
8
9
# File 'lib/synapse/event_sourcing/repository.rb', line 7

def aggregate_factory
  @aggregate_factory
end

#conflict_resolverConflictResolver

Returns:



10
11
12
# File 'lib/synapse/event_sourcing/repository.rb', line 10

def conflict_resolver
  @conflict_resolver
end

#event_storeEventStore (readonly)

Returns:



13
14
15
# File 'lib/synapse/event_sourcing/repository.rb', line 13

def event_store
  @event_store
end

#snapshot_policySnapshotPolicy

Returns:



16
17
18
# File 'lib/synapse/event_sourcing/repository.rb', line 16

def snapshot_policy
  @snapshot_policy
end

#snapshot_takerSnapshotTaker

Returns:



19
20
21
# File 'lib/synapse/event_sourcing/repository.rb', line 19

def snapshot_taker
  @snapshot_taker
end

#stream_decoratorsArray<EventStreamDecorator> (readonly)

Returns:



22
23
24
# File 'lib/synapse/event_sourcing/repository.rb', line 22

def stream_decorators
  @stream_decorators
end