peyk.fsm.storage.memory

In-process FSM storage.

Classes

MemoryStorage(*[, key_builder])

Store FSM state and data in process memory.

class peyk.fsm.storage.memory.MemoryStorage(*, key_builder: KeyBuilder | None = None)[source]

Bases: BaseStorage

Store FSM state and data in process memory.

async get_state(key: StorageKey | str) str | None[source]

Return the stored state for key.

async set_state(key: StorageKey | str, state: str | None) None[source]

Set or clear the stored state.

async get_data(key: StorageKey | str) dict[str, object][source]

Return a defensive copy of conversation data.

async set_data(key: StorageKey | str, data: Mapping[str, object]) None[source]

Replace conversation data with a defensive copy.

async update_data(key: StorageKey | str, data: Mapping[str, object] | None = None, **kwargs: object) dict[str, object][source]

Merge mapping and keyword values into conversation data.

async close() None[source]

Release in-memory data and mark the backend closed.