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.TimestampedVersionedEntityAn example event sourced domain model entity.
-
class
Event(**kwargs)[source]¶ Bases:
eventsourcing.domain.model.entity.Event,eventsourcing.domain.model.entity.EventSupertype for events of example entities.
-
class
Created(**kwargs)[source]¶ Bases:
eventsourcing.example.domainmodel.Event,eventsourcing.domain.model.entity.Created,eventsourcing.domain.model.entity.CreatedPublished when an Example is created.
-
class
AttributeChanged(**kwargs)[source]¶ Bases:
eventsourcing.example.domainmodel.Event,eventsourcing.domain.model.entity.AttributeChangedPublished when an Example is created.
-
class
Discarded(**kwargs)[source]¶ Bases:
eventsourcing.example.domainmodel.Event,eventsourcing.domain.model.entity.DiscardedPublished when an Example is discarded.
-
class
Heartbeat(**kwargs)[source]¶ Bases:
eventsourcing.example.domainmodel.Event,eventsourcing.domain.model.entity.EventPublished 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
infrastructure¶
-
class
eventsourcing.example.infrastructure.ExampleRepository(event_store: eventsourcing.infrastructure.base.AbstractEventStore, use_cache: bool = False, snapshot_strategy: Optional[eventsourcing.infrastructure.snapshotting.AbstractSnapshotStrategy] = None, mutator_func: Optional[Callable[[Optional[TVersionedEntity], TVersionedEvent], Optional[TVersionedEntity]]] = None, **kwargs)[source]¶ Bases:
eventsourcing.infrastructure.eventsourcedrepository.EventSourcedRepository,eventsourcing.example.domainmodel.AbstractExampleRepositoryEvent 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.ABCEvent 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.ApplicationWithPersistencePoliciesExample 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.
-