Aggregate Root¶
Module defining the base abstraction for Aggregate Roots and their version control.
aggregate_root
¶
Module defining the base abstraction for Aggregate Roots and their version control.
AggregateVersion
¶
Bases: ValueObject[int]
Immutable value object representing the version of an aggregate root.
Used for optimistic concurrency control to detect conflicting updates.
Source code in src/forging_blocks/domain/aggregate_root.py
value: int
property
¶
Return the integer version value.
AggregateRoot
¶
Bases: Entity[TId], Generic[TId], ABC
Base class for Aggregate Roots in a Domain-Driven Design context.
An Aggregate Root represents the entry point for manipulating
a consistency boundary composed of entities and value objects.
It encapsulates domain logic, maintains a version for concurrency control,
and records uncommitted domain events.
Source code in src/forging_blocks/domain/aggregate_root.py
version: AggregateVersion
property
¶
Return the current version of the aggregate.
collect_events() -> list[Event]
¶
Collect uncommitted events, clear array, increment the version and return events.