peyk.fsm.storage.isolation¶
FSM event isolation primitives.
Classes
Serialize handlers that share one |
|
Do not serialize events. |
|
|
Serialize events using Redis distributed locks. |
|
RedisLock provides the FSM API surface used by peyk. |
|
RedisLockClient provides the FSM API surface used by peyk. |
Serialize by key and evict idle locks after release. |
- class peyk.fsm.storage.isolation.BaseEventIsolation[source]¶
Bases:
objectSerialize handlers that share one
StorageKey.- lock(key: StorageKey) AsyncIterator[None][source]¶
Return an async context manager for the event lock.
- class peyk.fsm.storage.isolation.DisabledEventIsolation[source]¶
Bases:
BaseEventIsolationDo not serialize events.
- lock(key: StorageKey) AsyncIterator[None][source]¶
Performs the lock operation for the FSM client.
- Parameters:
key – Value used by this operation.
- Returns:
Result produced by the FSM operation.
- class peyk.fsm.storage.isolation.SimpleEventIsolation[source]¶
Bases:
BaseEventIsolationSerialize by key and evict idle locks after release.
- lock(key: StorageKey) AsyncIterator[None][source]¶
Performs the lock operation for the FSM client.
- Parameters:
key – Value used by this operation.
- Returns:
Result produced by the FSM operation.
- class peyk.fsm.storage.isolation.RedisLock(*args, **kwargs)[source]¶
Bases:
ProtocolRedisLock provides the FSM API surface used by peyk.
- class peyk.fsm.storage.isolation.RedisLockClient(*args, **kwargs)[source]¶
Bases:
ProtocolRedisLockClient provides the FSM API surface used by peyk.
- lock(name: str, timeout: float | None = None, sleep: float = 0.1, blocking: bool = True, blocking_timeout: float | None = None) RedisLock[source]¶
Performs the lock operation for the FSM client.
- Parameters:
name – Value used by this operation.
timeout – Maximum time to wait for the operation.
sleep – Value used by this operation.
blocking – Value used by this operation.
blocking_timeout – Value used by this operation.
- Returns:
Result produced by the FSM operation.
- class peyk.fsm.storage.isolation.RedisEventIsolation(redis: RedisLockClient, *, key_builder: KeyBuilder | None = None, lock_timeout: float | None = 30.0, blocking_timeout: float | None = None)[source]¶
Bases:
BaseEventIsolationSerialize events using Redis distributed locks.
- lock(key: StorageKey) AsyncIterator[None][source]¶
Performs the lock operation for the FSM client.
- Parameters:
key – Value used by this operation.
- Returns:
Result produced by the FSM operation.