The Durable Object namespace binding
The runtime services, and optional key namespacing
Attempts to acquire the lock.
The lock key
How long the claim lasts, in milliseconds
The token when acquired, or null when another holder is live
Releases a previously acquired lock.
A token that does not match the current holder is ignored by the object, so a caller whose claim already expired cannot release its successor's.
The lock key
The token acquire returned
A distributed lock backed by one Durable Object per key.
Structurally satisfies
scheduler-plugin'sIDistributedLockwithout importing it — that interface is internal to its own package, and AI_GUIDELINES §2.2/§3.3 forbid a plugin importing another plugin. The application hands an instance toSchedulerPlugin, the same wiringKvSessionStoreuses forSessionPlugin, because that option is read at plugin construction before any application exists.Correctness comes from the platform rather than from an algorithm: a Durable Object executes one request at a time, so the read-compare-write inside
DistributedLockObjectCoreis atomic with no transaction and no Redlock-style quorum.Example
Since
0.2.0