Expand description
Concurrency key gate for single-flight execution control.
This module defines typed concurrency key primitives and the gate logic that prevents runs with the same concurrency key from executing in parallel.
§Overview
A concurrency key is an optional string attached to a task that ensures only one run with that key can be in the Running state at a time.
§Key States
- Free: No run currently holds the key.
- Occupied: A run is currently holding the key and executing.
§Gate Operations
- Acquire: Attempts to acquire a key for a run. Returns
AcquireResult::Acquiredif the key is free, orAcquireResult::Occupiedif another run holds it. - Release: Releases a key, making it available for other runs.
- Query: Checking whether a key is currently occupied.
Structs§
- Concurrency
Key - A typed concurrency key that ensures runs with the same key don’t run in parallel.
- KeyGate
- A key gate state that tracks which run (if any) holds each concurrency key.
Enums§
- Acquire
Result - Result of a concurrency key acquisition attempt.
- Release
Result - Result of a concurrency key release attempt.