minos.aggregate.transactions.repositories.database.impl

Classes

DatabaseTransactionRepository

Database Transaction Repository class.

class DatabaseTransactionRepository[source]

Bases: DatabaseMixin[TransactionDatabaseOperationFactory], TransactionRepository

Database Transaction Repository class.

__init__(*args, database_key=None, **kwargs)[source]
Parameters

database_key (Optional[tuple[str]]) –

property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

property database_client_cls: type[minos.common.database.clients.abc.DatabaseClient]

Get the client’s class.

Returns

A type instance that is subclass of DatabaseClient.

property database_operation_factory: Optional[minos.common.database.mixins.GenericDatabaseOperationFactory]

Get the operation factory if any.

Returns

A OperationFactory if it has been set or None otherwise.

property database_pool: minos.common.database.pools.DatabaseClientPool

Get the database pool.

Returns

A DatabaseClientPool object.

async destroy()

Destroy miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

async execute_on_database(operation)

Submit an Operation.

Parameters

operation (DatabaseOperation) – The operation to be executed.

Returns

This method does not return anything.

Return type

None

async execute_on_database_and_fetch_all(operation, streaming_mode=None)

Submit an Operation and return an asynchronous iterator.

Parameters
  • operation (DatabaseOperation) – The operation to be executed.

  • streaming_mode (Optional[bool]) – If True return the values in streaming directly from the database (keep an open database connection), otherwise preloads the full set of values on memory and then retrieves them.

Returns

This method does not return anything.

Return type

AsyncIterator[tuple]

async execute_on_database_and_fetch_one(operation)

Submit an Operation and get the first response.

Parameters

operation (DatabaseOperation) – The operation to be executed.

Returns

This method does not return anything.

Return type

Any

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 get(uuid, **kwargs)

Get a TransactionEntry from its identifier.

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

  • kwargs – Additional named arguments.

Returns

The TransactionEntry instance.

Return type

TransactionEntry

classmethod get_injectable_name()

Get the injectable name.

Returns

A str value.

Return type

str

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)

Get a transaction from the repository.

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

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

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

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

  • status (Optional[TransactionStatus]) – Transaction status equal to the given value.

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

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

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

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

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

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

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

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

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

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

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

  • kwargs – Additional named arguments.

Returns

An asynchronous iterator.

Return type

AsyncIterator[TransactionEntry]

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

async submit(transaction)

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

Parameters

transaction (TransactionEntry) – The transaction to be stored.

Returns

This method does not return anything.

Return type

TransactionEntry

write_lock()

Get write lock.

Returns

An asynchronous context manager.

Return type

Lock