A thin, real wrapper around Reactor.Executor.ConcurrencyTracker that
bounds concurrent planning work.
Reactor.Executor.ConcurrencyTracker is a GenServer already started by
the vendored :reactor OTP application's supervision tree
(deps/reactor/lib/reactor/application.ex), so this module does not start
or own that process — it only allocates/uses pools against it.
A pool is identified by an opaque pool_key (a reference/0, per the real
ConcurrencyTracker API). acquire/2 returns the number of slots actually
granted (which may be less than requested, or zero, per the real
ConcurrencyTracker.acquire/2 contract) rather than blocking.
Summary
Functions
Attempt to acquire how_many planning slots (default 1) from the pool.
Tear down the pool. Does not affect slots already acquired by users.
Allocate a new bounded planning pool with limit concurrent slots.
Release how_many (default 1) previously acquired slots back to the pool.
Release all acquired slots for the calling process automatically when it exits.
Return {:ok, available, limit} for the pool, or {:error, reason}.
Types
@type pool_key() :: Reactor.Executor.ConcurrencyTracker.pool_key()
Functions
@spec acquire(pool_key(), pos_integer()) :: {:ok, non_neg_integer()}
Attempt to acquire how_many planning slots (default 1) from the pool.
Returns {:ok, n} where n is the number of slots actually granted; n
may be less than how_many, including 0, if the pool is exhausted. The
caller must only proceed with the work it was actually granted slots for.
@spec destroy(pool_key()) :: :ok
Tear down the pool. Does not affect slots already acquired by users.
@spec new(pos_integer()) :: pool_key()
Allocate a new bounded planning pool with limit concurrent slots.
@spec release(pool_key(), pos_integer()) :: :ok | :error
Release how_many (default 1) previously acquired slots back to the pool.
Release all acquired slots for the calling process automatically when it exits.
@spec status(pool_key()) :: {:ok, non_neg_integer(), pos_integer()} | {:error, any()}
Return {:ok, available, limit} for the pool, or {:error, reason}.