Skip to content

StateMachine

Canonical path: o6.pubsub.StateMachine

StateMachine

Bases: Protocol

Callable implementing the transition of one PubSub component.

Functions

__call__

__call__(current, target)

Move the component from one state to another.

Called synchronously on the server's event loop, so it must not block.

Parameters:

Name Type Description Default
current PubSubState

The component's current PubSubState.

required
target PubSubState

The PubSubState the server is requesting.

required

Returns:

Type Description
StatusCode

The StatusCode of the transition and the state actually reached. A bad

PubSubState

status, an exception, a recursive transition, or a malformed result

tuple[StatusCode, PubSubState]

moves the component to ERROR.