Quiver.Pool.HTTP2.Connection (quiver v0.2.0)

Copy Markdown View Source

gen_state_machine process owning a single HTTP/2 connection.

Manages stream multiplexing, caller monitoring, and GOAWAY drain logic. The process transitions from :connected to :draining when a GOAWAY is received or the server closes the connection, completing in-flight requests before stopping.

Summary

Functions

Returns the number of stream slots available on this connection.

Returns a specification to start this module under a supervisor.

Closes the connection, failing any in-flight requests.

Returns the server's max concurrent streams setting.

Returns true if the connection is open and accepting new streams.

Sends an HTTP/2 request and blocks until the response is complete.

Starts the connection worker and performs the HTTP/2 handshake.

Types

t()

@type t() :: %Quiver.Pool.HTTP2.Connection{
  config: keyword(),
  conn: Quiver.Conn.HTTP2.t() | nil,
  monitors: map(),
  origin: term(),
  pool_pid: pid() | nil,
  requests: map(),
  write_queue: [iodata()]
}

Functions

available_streams(pid)

@spec available_streams(pid()) :: non_neg_integer()

Returns the number of stream slots available on this connection.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(pid)

@spec close(pid()) :: :ok

Closes the connection, failing any in-flight requests.

connected(arg1, msg, data)

draining(arg1, msg, data)

max_streams(pid)

@spec max_streams(pid()) :: non_neg_integer()

Returns the server's max concurrent streams setting.

open?(pid)

@spec open?(pid()) :: boolean()

Returns true if the connection is open and accepting new streams.

request(pid, method, path, headers, body, opts \\ [])

@spec request(pid(), atom(), String.t(), list(), iodata() | nil, keyword()) ::
  {:ok, Quiver.Response.t()} | {:error, term()}

Sends an HTTP/2 request and blocks until the response is complete.

start_link(opts)

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

Starts the connection worker and performs the HTTP/2 handshake.