minos.aggregate.transactions.entries
Classes
Transaction Entry class. |
|
Transaction Status Enum. |
- class TransactionEntry[source]
Bases:
object
Transaction Entry class.
- __init__(uuid=None, status=None, event_offset=None, destination_uuid=None, updated_at=None, autocommit=True, event_repository=None, transaction_repository=None)[source]
- Parameters
uuid (Optional[UUID]) –
status (Union[str, TransactionStatus]) –
event_offset (Optional[int]) –
destination_uuid (Optional[UUID]) –
updated_at (Optional[datetime]) –
autocommit (bool) –
event_repository (Optional[EventRepository]) –
transaction_repository (Optional[TransactionRepository]) –
- uuid
- status
- event_offset
- destination_uuid
- updated_at
- async commit()[source]
Commit transaction changes.
- Returns
This method does not return anything.
- Return type
None
- async reserve()[source]
Reserve transaction changes to be ensured that they can be applied.
- Returns
This method does not return anything.
- Return type
None
- async validate()[source]
Check if the transaction is committable.
- Returns
True
if the transaction is valid orFalse
otherwise.- Return type
- async reject()[source]
Reject transaction changes.
- Returns
This method does not return anything.
- Return type
None
- async save(*, event_offset=None, status=None)[source]
Saves the transaction into the repository.
- Parameters
status (Optional[TransactionStatus]) – The status.
- Returns
This method does not return anything.
- Return type
None
- property uuids: tuple[uuid.UUID, ...]
Get the sequence of transaction identifiers, from the outer one (
NULL_UUID
) to the one related with self.- Returns
A tuple of
UUID
values.
- property destination: Optional[minos.aggregate.transactions.entries.TransactionEntry]
Get the destination transaction if there is anyone, otherwise
None
is returned.- Returns
A
TransactionEntry
orNone
.
- class TransactionStatus[source]
-
Transaction Status Enum.
- PENDING = 'pending'
- RESERVING = 'reserving'
- RESERVED = 'reserved'
- COMMITTING = 'committing'
- COMMITTED = 'committed'
- REJECTED = 'rejected'