HTTP.HTTP2.Pool (http_runtime v0.16.1)

View Source

Bounded profile-aware HTTP/2 connection pool.

Summary

Functions

Returns a specification to start this module under a supervisor.

Claims the per-key connection slot for an out-of-band connector.

Fails an out-of-band connection attempt and wakes queued reservations.

Stops new reservations on an owner that received GOAWAY.

Atomically reserves one stream slot for key.

Reserves an available stream without queueing or starting a connection.

Updates capability observed in valid peer SETTINGS for one connection.

Updates one owner's effective peer stream limit.

Types

key()

@type key() :: term()

reservation()

@type reservation() :: reference()

Functions

cancel(pool, reservation)

@spec cancel(pid(), reservation()) :: :ok | {:error, :unknown_reservation}

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

claim_connect(pool, key)

@spec claim_connect(pid(), key()) :: :start | :wait

Claims the per-key connection slot for an out-of-band connector.

fail_connect(pool, key, reason)

@spec fail_connect(pid(), key(), term()) :: :ok

Fails an out-of-band connection attempt and wakes queued reservations.

mark_draining(pool, key, owner)

@spec mark_draining(pid(), key(), pid()) :: :ok

Stops new reservations on an owner that received GOAWAY.

register(pool, key, owner, opts \\ [])

@spec register(pid(), key(), pid(), keyword()) ::
  :ok | {:error, :connector_cancelled | :owner_closed | :connection_capacity}

release(pool, key, reservation)

@spec release(pid(), key(), reservation()) :: :ok

reserve(pool, key, opts \\ [])

@spec reserve(pid(), key(), keyword()) ::
  {:ok, pid(), reservation()} | {:connect, reservation()} | {:error, term()}

Atomically reserves one stream slot for key.

start_link(opts \\ [])

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

stats(pool)

@spec stats(pid()) :: map()

try_reserve(pool, key)

@spec try_reserve(pid(), key()) :: {:ok, pid(), reservation()} | :none

Reserves an available stream without queueing or starting a connection.

update_capabilities(pool, key, owner, capabilities)

@spec update_capabilities(pid(), key(), pid(), map()) ::
  :ok | {:error, :unknown_owner | :invalid_capabilities}

Updates capability observed in valid peer SETTINGS for one connection.

update_capacity(pool, key, owner, limit)

Updates one owner's effective peer stream limit.