Skip to main content

Module key_gate

Module key_gate 

Source
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::Acquired if the key is free, or AcquireResult::Occupied if another run holds it.
  • Release: Releases a key, making it available for other runs.
  • Query: Checking whether a key is currently occupied.

Structs§

ConcurrencyKey
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§

AcquireResult
Result of a concurrency key acquisition attempt.
ReleaseResult
Result of a concurrency key release attempt.