minos.aggregate.transactions.repositories.abc module

class minos.aggregate.transactions.repositories.abc.TransactionRepository(lock_pool=<dependency_injector.wiring.Provide object>, *args, **kwargs)[source]

Bases: abc.ABC, minos.common.setup.MinosSetup

Transaction Repository base class.

__init__(lock_pool=<dependency_injector.wiring.Provide object>, *args, **kwargs)[source]
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 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.

async get(uuid, **kwargs)[source]

Get a TransactionEntry from its identifier.

Parameters
  • uuid (uuid.UUID) – Identifier of the Aggregate.

  • kwargs – Additional named arguments.

Return type

minos.aggregate.transactions.entries.TransactionEntry

Returns

The TransactionEntry instance.

async select(uuid=None, uuid_ne=None, uuid_in=None, destination_uuid=None, status=None, status_in=None, event_offset=None, event_offset_lt=None, event_offset_gt=None, event_offset_le=None, event_offset_ge=None, updated_at=None, updated_at_lt=None, updated_at_gt=None, updated_at_le=None, updated_at_ge=None, **kwargs)[source]

Get a transaction from the repository.

Parameters
  • uuid (typing.Optional[uuid.UUID]) – Transaction identifier equal to the given value.

  • uuid_ne (typing.Optional[uuid.UUID]) – Transaction identifier not equal to the given value

  • uuid_in (typing.Optional[tuple[uuid.UUID, …]]) – Transaction identifier within the given values.

  • destination_uuid (typing.Optional[uuid.UUID]) – Destination Transaction identifier equal to the given value.

  • status (typing.Optional[minos.aggregate.transactions.entries.TransactionStatus]) – Transaction status equal to the given value.

  • status_in (typing.Optional[tuple[str, …]]) – Transaction status within the given values

  • event_offset (typing.Optional[int]) – Event offset equal to the given value.

  • event_offset_lt (typing.Optional[int]) – Event Offset lower than the given value

  • event_offset_gt (typing.Optional[int]) – Event Offset greater than the given value

  • event_offset_le (typing.Optional[int]) – Event Offset lower or equal to the given value

  • event_offset_ge (typing.Optional[int]) – Event Offset greater or equal to the given value

  • updated_at (typing.Optional[datetime.datetime]) – Updated at equal to the given value.

  • updated_at_lt (typing.Optional[datetime.datetime]) – Updated at lower than the given value.

  • updated_at_gt (typing.Optional[datetime.datetime]) – Updated at greater than the given value.

  • updated_at_le (typing.Optional[datetime.datetime]) – Updated at lower or equal to the given value.

  • updated_at_ge (typing.Optional[datetime.datetime]) – Updated at greater or equal to the given value.

  • kwargs – Additional named arguments.

Return type

typing.AsyncIterator[minos.aggregate.transactions.entries.TransactionEntry]

Returns

An asynchronous iterator.

async setup()

Setup miscellaneous repository things.

Return type

None

Returns

This method does not return anything.

async submit(transaction)[source]

Submit a new or updated transaction to store it on the repository.

Parameters

transaction (minos.aggregate.transactions.entries.TransactionEntry) – The transaction to be stored.

Return type

minos.aggregate.transactions.entries.TransactionEntry

Returns

This method does not return anything.

write_lock()[source]

Get a write lock.

Return type

minos.common.locks.Lock

Returns

An asynchronous context manager.