avl._core.transaction module

class avl._core.transaction.Transaction(*args: Any, **kwargs: Any)[source]
__init__(name: str, parent: Component) None[source]

Initialize a new Transaction.

Parameters:

name (str) – The name of the transaction.

set_id(id: int) None[source]

Set the ID of the transaction.

Parameters:

id (int) – The ID to set.

get_id() int[source]

Get the ID of the transaction.

Returns:

The ID of the transaction.

Return type:

int

add_event(name: str, callback: Callable[[...], Any] | None = None) None[source]

Add an event to the transaction.

Parameters:
  • name (str) – The name of the event.

  • callback (function or None) – The callback function to be called when the event is set.

get_event(name: str) None[source]

Get an event by name.

Parameters:

name (str) – The name of the event.

Returns:

The event details or None if the event does not exist.

Return type:

list or None

set_event(name: str, *args: list[Any], **kwargs: list[Any]) None[source]

Set an event and trigger its callbacks.

Parameters:
  • name (str) – The name of the event.

  • args – Additional arguments for the callback.

  • kwargs – Additional keyword arguments for the callback.

async wait_on_event(name: str) None[source]

Wait for an event to be set.

Parameters:

name (str) – The name of the event.