minos.saga.executions.steps.abc

Classes

SagaStepExecution

Saga Step Execution class.

class SagaStepExecution[source]

Bases: ABC

Saga Step Execution class.

__init__(definition, related_services=None, status=SagaStepStatus.Created, already_rollback=False)[source]
Parameters
classmethod from_raw(raw, **kwargs)[source]

Build a new instance from a raw representation.

Parameters
Returns

A SagaStepExecution instance.

Return type

SagaStepExecution

static from_definition(step)[source]

Build a SagaStepExecution instance from the SagaStep definition.

Parameters

step (SagaStep) – The SagaStep definition.

Returns

A new SagaStepExecution.

Return type

SagaStepExecution

abstract async execute(context, *args, **kwargs)[source]

Execution the step.

Parameters
  • context (SagaContext) – The execution context to be used during the execution.

  • args – Additional positional arguments.

  • kwargs – Additional named arguments.

Returns

The updated context.

Return type

SagaContext

abstract async rollback(context, *args, **kwargs)[source]

Revert the executed step.

Parameters
  • context (SagaContext) – Execution context.

  • args – Additional positional arguments.

  • kwargs – Additional named arguments.

Returns

The updated execution context.

Return type

SagaContext

property raw: dict[str, Any]

Compute a raw representation of the instance.

Returns

A dict instance.