minos.aggregate.events.repositories.memory module¶
- class minos.aggregate.events.repositories.memory.InMemoryEventRepository(*args, **kwargs)[source]¶
Bases:
minos.aggregate.events.repositories.abc.EventRepository
Memory-based implementation of the event repository class in
minos
.- property already_destroyed: bool¶
Already Destroy getter.
- Return type
bool
- Returns
A boolean value.
- property already_setup: bool¶
Already Setup getter.
- Return type
bool
- Returns
A boolean value.
- async create(entry)¶
Store new creation entry into the repository.
- Parameters
entry (
typing.Union
[minos.aggregate.models.diffs.aggregates.AggregateDiff
,minos.aggregate.events.entries.EventEntry
]) – Entry to be stored.- Return type
- Returns
The repository entry containing the stored information.
- async delete(entry)¶
Store new deletion entry into the repository.
- Parameters
entry (
typing.Union
[minos.aggregate.models.diffs.aggregates.AggregateDiff
,minos.aggregate.events.entries.EventEntry
]) – Entry to be stored.- Return type
- Returns
The repository entry containing the stored information.
- async destroy()¶
Destroy miscellaneous repository things.
- Return type
None
- Returns
This method does not return anything.
- classmethod from_config(config=None, **kwargs)¶
Build a new instance from config.
- Parameters
config (
typing.Union
[minos.common.configuration.config.MinosConfig
,pathlib.Path
,None
]) – Config instance. If None is provided, default config is chosen.kwargs – Additional named arguments.
- Return type
~S
- Returns
A instance of the called class.
- property offset: Awaitable[int]¶
Get the current repository offset.
- Return type
typing.Awaitable
[int
]- Returns
An awaitable containing an integer value.
- async select(aggregate_uuid=None, aggregate_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
aggregate_uuid (
typing.Optional
[uuid.UUID
]) – Aggregate identifier.aggregate_name (
typing.Optional
[str
]) – Aggregate name.version (
typing.Optional
[int
]) – Aggregate version.version_lt (
typing.Optional
[int
]) – Aggregate version lower than the given value.version_gt (
typing.Optional
[int
]) – Aggregate version greater than the given value.version_le (
typing.Optional
[int
]) – Aggregate version lower or equal to the given value.version_ge (
typing.Optional
[int
]) – Aggregate version greater or equal to the given value.id (
typing.Optional
[int
]) – Entry identifier.id_lt (
typing.Optional
[int
]) – Entry identifier lower than the given value.id_gt (
typing.Optional
[int
]) – Entry identifier greater than the given value.id_le (
typing.Optional
[int
]) – Entry identifier lower or equal to the given value.id_ge (
typing.Optional
[int
]) – Entry identifier greater or equal to the given value.transaction_uuid (
typing.Optional
[uuid.UUID
]) – Transaction identifier.transaction_uuid_ne (
typing.Optional
[uuid.UUID
]) – Transaction identifier distinct of the given value.transaction_uuid_in (
typing.Optional
[tuple
[uuid.UUID
, …]]) – Destination Transaction identifier equal to one of the given values.
- Return type
typing.AsyncIterator
[minos.aggregate.events.entries.EventEntry
]- Returns
A list of entries.
- async setup()¶
Setup miscellaneous repository things.
- Return type
None
- Returns
This method does not return anything.
- async submit(entry, **kwargs)¶
Store new entry into the repository.
- Parameters
entry (
typing.Union
[minos.aggregate.models.diffs.aggregates.AggregateDiff
,minos.aggregate.events.entries.EventEntry
]) – The entry to be stored.kwargs – Additional named arguments.
- Return type
- Returns
The repository entry containing the stored information.
- transaction(**kwargs)¶
Build a transaction instance related to the repository.
- Parameters
kwargs – Additional named arguments.
- Return type
- Returns
A new
TransactionEntry
instance.
- async update(entry)¶
Store new update entry into the repository.
- Parameters
entry (
typing.Union
[minos.aggregate.models.diffs.aggregates.AggregateDiff
,minos.aggregate.events.entries.EventEntry
]) – Entry to be stored.- Return type
- Returns
The repository entry containing the stored information.
- async validate(entry, transaction_uuid_ne=None, **kwargs)¶
Check if it is able to submit the given entry.
- Parameters
entry (
minos.aggregate.events.entries.EventEntry
) – The entry to be validated.transaction_uuid_ne (
typing.Optional
[uuid.UUID
]) – Optional transaction identifier to skip it from the validation.kwargs – Additional named arguments.
- Return type
bool
- Returns
True
if the entry can be submitted orFalse
otherwise.
- write_lock()¶
Get a write lock.
- Return type
minos.common.locks.Lock
- Returns
An asynchronous context manager.