Class: Synapse::EventStore::EventStore Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse/event_store/event_store.rb

Overview

This class is abstract.

Represents a mechanism for reading and appending streams of domain events

Direct Known Subclasses

SnapshotEventStore

Instance Method Summary collapse

Instance Method Details

#append_events(type_identifier, stream) ⇒ undefined

This method is abstract.

Appends the domain events in the given stream to the event store

Parameters:

  • type_identifier (String)

    Type descriptor of the aggregate to append to

  • stream (DomainEventStream)

Returns:

  • (undefined)

Raises:

  • (EventStoreError)

    If an error occurs while appending the stream to the store



29
30
31
# File 'lib/synapse/event_store/event_store.rb', line 29

def append_events(type_identifier, stream)
  raise NotImplementedError
end

#read_events(type_identifier, aggregate_id) ⇒ DomainEventStream

This method is abstract.

Fetches an event stream for the aggregate identified by the given type identifier and the given aggregate identifier. This stream can be used to rebuild the state of the aggregate.

Implementations may omit or replace events (for example, with snapshot events) from the stream for performance purposes.

Parameters:

  • type_identifier (String)

    Type descriptor of the aggregate to retrieve

  • aggregate_id (Object)

Returns:

  • (DomainEventStream)

Raises:

  • (EventStoreError)

    If an error occurs while reading the stream from the store



18
19
20
# File 'lib/synapse/event_store/event_store.rb', line 18

def read_events(type_identifier, aggregate_id)
  raise NotImplementedError
end