minos.aggregate.transactions.entries

Classes

TransactionEntry

Transaction Entry class.

TransactionStatus

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
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 or False otherwise.

Return type

bool

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
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 or None.

as_raw()[source]

Get a raw representation of the instance.

Returns

A dictionary in which the keys are attribute names and values the attribute contents.

Return type

dict[str, Any]

class TransactionStatus[source]

Bases: str, Enum

Transaction Status Enum.

PENDING = 'pending'
RESERVING = 'reserving'
RESERVED = 'reserved'
COMMITTING = 'committing'
COMMITTED = 'committed'
REJECTED = 'rejected'
classmethod value_of(value)[source]

Get the status based on its text representation.

Parameters

value (str) –

Return type

TransactionStatus