# `Quiver.Pool.HTTP3`
[🔗](https://github.com/edlontech/quiver/blob/main/lib/quiver/pool/http3.ex#L1)

HTTP/3 pool coordinator.

A gen_state_machine per origin that routes concurrent callers to available
stream slots across one or more `Pool.HTTP3.Connection` workers. Mirrors
`Pool.HTTP2`: eagerly opens new connections until `max_connections` is reached,
least-loaded picks across connections with available stream capacity, and
queues callers when all slots are saturated.

States: `:idle` -> `:connected`. The coordinator self-registers in
`:persistent_term` so that `Pool.Manager` can detect the protocol from a
bare pid. Uses the two-phase caller model: the caller issues a gen_statem
call to the coordinator, the coordinator forwards `{:forward_request, from, ...}`
to the connection worker, and the worker replies directly to the caller's
`from`.

HTTP/3 handshake is asynchronous (`:connecting` -> `:connected` inside the
worker), so a freshly started connection cannot accept requests yet. The
worker notifies the coordinator with `{:connection_ready, pid, max_streams}`
on entering `:connected`, at which point the coordinator flips the per-
connection entry from `:connecting` to `:connected` and starts picking it.

# `t`

```elixir
@type t() :: %Quiver.Pool.HTTP3{
  checkout_timeout: pos_integer(),
  config: keyword(),
  conn_sup: pid() | nil,
  connections: map(),
  early_connecting: pid() | nil,
  max_connections: pos_integer(),
  origin: term(),
  tickets: [{term(), integer()}],
  waiting: :queue.queue()
}
```

# `connected`

# `idle`

# `open_channel`

```elixir
@spec open_channel(pid(), atom(), String.t(), list(), keyword(), keyword()) ::
  {:ok, Quiver.HTTP3.Channel.t(), reference()} | {:error, term()}
```

Opens a datagram channel through this pool. Internal entry point used by
`Quiver.HTTP3.open_datagram_channel/4`.

Forwards `{:forward_open_channel, from, method, path, headers, channel_opts}`
to a picked worker, mirroring the `:forward_request` two-phase model. The
worker replies directly to `from` with `{:ok, %Channel{}, ref}` or
`{:error, term}`.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts the HTTP/3 pool coordinator.

---

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