example¶
A simple, unit-tested, event sourced application.
domainmodel¶
-
class
eventsourcing.example.domainmodel.
Example
(foo='', a='', b='', **kwargs)[source]¶ Bases:
eventsourcing.domain.model.entity.EntityWithHashchain
,eventsourcing.domain.model.entity.TimestampedVersionedEntity
An example event sourced domain model entity.
-
class
Event
(**kwargs)[source]¶ Bases:
eventsourcing.domain.model.entity.Event
,eventsourcing.domain.model.entity.Event
Supertype for events of example entities.
-
class
Created
(**kwargs)[source]¶ Bases:
eventsourcing.example.domainmodel.Event
,eventsourcing.domain.model.entity.Created
,eventsourcing.domain.model.entity.Created
Published when an Example is created.
-
class
AttributeChanged
(**kwargs)[source]¶ Bases:
eventsourcing.example.domainmodel.Event
,eventsourcing.domain.model.entity.AttributeChanged
Published when an Example is created.
-
class
Discarded
(**kwargs)[source]¶ Bases:
eventsourcing.example.domainmodel.Event
,eventsourcing.domain.model.entity.Discarded
Published when an Example is discarded.
-
class
Heartbeat
(**kwargs)[source]¶ Bases:
eventsourcing.example.domainmodel.Event
,eventsourcing.domain.model.entity.Event
Published when a heartbeat in the entity occurs (see below).
-
__init__
(foo='', a='', b='', **kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
foo
¶ An example attribute.
-
a
¶ An example attribute.
-
b
¶ Another example attribute.
-
class
-
class
eventsourcing.example.domainmodel.
AbstractExampleRepository
[source]¶ Bases:
eventsourcing.infrastructure.base.AbstractEntityRepository
infrastructure¶
-
class
eventsourcing.example.infrastructure.
ExampleRepository
(event_store: eventsourcing.infrastructure.base.AbstractEventStore, use_cache: bool = False, **kwargs)[source]¶ Bases:
eventsourcing.infrastructure.eventsourcedrepository.EventSourcedRepository
,eventsourcing.example.domainmodel.AbstractExampleRepository
Event sourced repository for the Example domain model entity.
application¶
-
class
eventsourcing.example.application.
ApplicationWithEventStores
(entity_record_manager=None, log_record_manager=None, snapshot_record_manager=None, cipher=None, sequenced_item_mapper_class=<class 'eventsourcing.infrastructure.sequenceditemmapper.SequencedItemMapper'>)[source]¶ Bases:
abc.ABC
Event sourced application object class.
Can construct event stores using given database records. Supports three different event stores: for log events, for entity events, and for snapshot events.
-
class
eventsourcing.example.application.
ApplicationWithPersistencePolicies
(**kwargs)[source]¶ Bases:
eventsourcing.example.application.ApplicationWithEventStores
-
class
eventsourcing.example.application.
ExampleApplication
(**kwargs)[source]¶ Bases:
eventsourcing.example.application.ApplicationWithPersistencePolicies
Example event sourced application with entity factory and repository.
-
eventsourcing.example.application.
construct_example_application
(**kwargs)[source]¶ Application object factory.
-
eventsourcing.example.application.
init_example_application
(**kwargs)[source]¶ Constructs single global instance of application.
To be called when initialising a worker process.
interface¶
-
class
eventsourcing.example.interface.flaskapp.
IntegerSequencedItem
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Model
-
__init__
(**kwargs)¶ A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-