minos.aggregate.events.repositories.abc
Classes
- class EventRepository[source]
Bases:
EventRepository
,InjectableMixin
- __init__(broker_publisher, transaction_repository, lock_pool=None, pool_factory=None, *args, **kwargs)[source]
- Parameters
broker_publisher (BrokerPublisher) –
transaction_repository (TransactionRepository) –
pool_factory (Optional[PoolFactory]) –
- transaction(**kwargs)[source]
Build a transaction instance related to the repository.
- Parameters
kwargs – Additional named arguments.
- Returns
A new
TransactionEntry
instance.- Return type
- async create(entry)[source]
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 update(entry)[source]
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 delete(entry)[source]
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 submit(entry, **kwargs)[source]
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
- async validate(entry, transaction_uuid_ne=None, **kwargs)[source]
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
- 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)[source]
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]
- property offset: Awaitable[int]
Get the current repository offset.
- Returns
An awaitable containing an integer value.
- 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
- async setup()
Setup miscellaneous repository things.
- Returns
This method does not return anything.
- Return type
None