SwooleTableState
class SwooleTableState
Coordinates multi-step Swoole table row mutations across workers.
Swoole Table does not currently provide full-row compare-and-swap, set-if-absent, or delete-if-current primitives, so cache operations that need atomic read-check-write behavior use striped shared Atomics around tiny critical sections.
Constants
| protected STRIPE_COUNT |
|
| protected SPINS_BEFORE_BACKOFF |
|
| protected LOCK_ACQUIRE_TIMEOUT_NANOSECONDS |
|
Properties
| protected Atomic> | $rowLocks | Striped locks for row lifecycle operations. |
Methods
Get the Swoole table.
Get the hash seed.
Run the callback while holding the row lock for the given table key.
Run the callback while holding every row-lock stripe.
Get the striped lock for a table key.
Acquire a striped lock.
Release a striped lock.
Details
at line 40
__construct(SwooleTable $table, int $hashSeed = 0)
Create a new Swoole table state instance.
at line 55
SwooleTable
table()
Get the Swoole table.
at line 63
int
hashSeed()
Get the hash seed.
at line 75
mixed
withRowLock(string $key, callable $callback)
Run the callback while holding the row lock for the given table key.
at line 94
mixed
withAllRowLocks(callable $callback)
Run the callback while holding every row-lock stripe.
at line 115
protected Atomic
lockFor(string $key)
Get the striped lock for a table key.
at line 123
protected void
acquire(Atomic $lock)
Acquire a striped lock.
at line 147
protected void
release(Atomic $lock)
Release a striped lock.