minos.aggregate.events.repositories.memory
Classes
Memory-based implementation of the event repository class in |
- class InMemoryEventRepository[source]
Bases:
EventRepository
Memory-based implementation of the event repository class in
minos
.- async create(entry)
Store new creation entry into the repository.
- Parameters
entry (Union[Event, EventEntry]) – Entry to be stored.
- Returns
The repository entry containing the stored information.
- Return type
- async delete(entry)
Store new deletion entry into the repository.
- Parameters
entry (Union[Event, EventEntry]) – Entry to be stored.
- Returns
The repository entry containing the stored information.
- Return type
- async destroy()
Destroy miscellaneous repository things.
- Returns
This method does not return anything.
- Return type
None
- classmethod from_config(config=None, **kwargs)
Build a new instance from config.
- Parameters
config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.
kwargs – Additional named arguments.
- Returns
A instance of the called class.
- Return type
S
- property offset: Awaitable[int]
Get the current repository offset.
- Returns
An awaitable containing an integer value.
- async select(uuid=None, name=None, version=None, version_lt=None, version_gt=None, version_le=None, version_ge=None, id=None, id_lt=None, id_gt=None, id_le=None, id_ge=None, transaction_uuid=None, transaction_uuid_ne=None, transaction_uuid_in=None, **kwargs)
Perform a selection query of entries stored in to the repository.
- Parameters
uuid (Optional[UUID]) – The identifier must be equal to the given value.
name (Optional[Union[str, type[RootEntity]]]) – The classname must be equal to the given value.
version (Optional[int]) – The version must be equal to the given value.
version_lt (Optional[int]) – The version must be lower than the given value.
version_gt (Optional[int]) – The version must be greater than the given value.
version_le (Optional[int]) – The version must be lower or equal to the given value.
version_ge (Optional[int]) – The version must be greater or equal to the given value.
id (Optional[int]) – The entry identifier must be equal to the given value.
id_lt (Optional[int]) – The entry identifier must be lower than the given value.
id_gt (Optional[int]) – The entry identifier must be greater than the given value.
id_le (Optional[int]) – The entry identifier must be lower or equal to the given value.
id_ge (Optional[int]) – The entry identifier must be greater or equal to the given value.
transaction_uuid (Optional[UUID]) – The transaction identifier must be equal to the given value.
transaction_uuid_ne (Optional[UUID]) – The transaction identifier must be distinct of the given value.
transaction_uuid_in (Optional[tuple[UUID, ...]]) – The destination transaction identifier must be equal to one of the given values.
- Returns
A list of entries.
- Return type
AsyncIterator[EventEntry]
- async setup()
Setup miscellaneous repository things.
- Returns
This method does not return anything.
- Return type
None
- async submit(entry, **kwargs)
Store new entry into the repository.
- Parameters
entry (Union[Event, EventEntry]) – The entry to be stored.
kwargs – Additional named arguments.
- Returns
The repository entry containing the stored information.
- Return type
- transaction(**kwargs)
Build a transaction instance related to the repository.
- Parameters
kwargs – Additional named arguments.
- Returns
A new
TransactionEntry
instance.- Return type
- async update(entry)
Store new update entry into the repository.
- Parameters
entry (Union[Event, EventEntry]) – Entry to be stored.
- Returns
The repository entry containing the stored information.
- Return type
- async validate(entry, transaction_uuid_ne=None, **kwargs)
Check if it is able to submit the given entry.
- Parameters
entry (EventEntry) – The entry to be validated.
transaction_uuid_ne (Optional[UUID]) – Optional transaction identifier to skip it from the validation.
kwargs – Additional named arguments.
- Returns
True
if the entry can be submitted orFalse
otherwise.- Return type