BaseEventIsolation
in package
Abstract base for FSM event-isolation strategies.
Event isolation controls whether concurrent updates for the same
StorageKey are serialised (one-at-a-time) or allowed to race.
Ported from aiogram.fsm.storage.base.BaseEventIsolation
(aiogram/fsm/storage/base.py:200-208).
The upstream Python implementation uses @asynccontextmanager, which
yields None and relies on a try/finally inside the context-manager
body to release the underlying primitive. PHP has no context-manager
syntax, so we expose the equivalent acquire/release pair via a Lock
value-object (Option A from the spec). Caller pattern:
$lock = $isolation->lock($key);
try {
// critical section
} finally {
$lock->release();
}
Table of Contents
Methods
- close() : void
- Release all resources held by this isolation instance.
- lock() : Lock
- Acquire an isolation lock for `$key`.
Methods
close()
Release all resources held by this isolation instance.
public
abstract close() : void
Mirrors BaseEventIsolation.close (upstream: abstract async def close).
lock()
Acquire an isolation lock for `$key`.
public
abstract lock(StorageKey $key) : Lock
Returns a Lock whose release() must be called (preferably from a
finally block) once the critical section is done.
Parameters
- $key : StorageKey
-
Storage address to lock.