# `Opsmaru.Incus.Gateway.Admission`
[🔗](https://github.com/upmaru/opsmaru-incus/blob/v0.1.0/lib/opsmaru/incus/gateway/admission.ex#L1)

Host-started bounded admission for gateway exchanges.

Add `{Opsmaru.Incus.Gateway.Admission, name: MyHost.GatewayAdmission,
max_exchanges: 64}` to the host's supervision tree when mounting the gateway;
the library never starts it. Each relayed exchange holds one slot from before
host callbacks run until its backend socket is closed. At capacity a request
is rejected immediately: nothing is queued and no backend is opened.

Slots are tied to the holding process and released when it exits. A relay
monitors the admission process and stops its own backend socket if admission
stops or restarts, so a restart never leaves untracked backend traffic.
Status and crash reports show only counts.

# `acquire`

Take one slot for `holder`. Returns `{:ok, slot}`, `{:error, :capacity}` or
`{:error, :unavailable}` when admission is not running.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `count`

Current number of held slots.

# `release`

Release a slot. Idempotent; exiting holders are released automatically.

# `start_link`

# `transfer`

Move an existing slot to its protocol owner without reacquiring capacity.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
