HTTP.HTTP2.ConnectionOwner (http_runtime v0.16.0)

View Source

Long-lived, single-writer HTTP/2 connection runtime.

The protocol state remains in HTTP.HTTP2.Connection; this process owns the socket, serializes writes, and routes incoming frames to request owners.

Summary

Types

t()

@type t() :: %{
  lifecycle: :connecting | :initializing | :ready | :draining | :closed,
  socket: term(),
  transport: transport(),
  connection: HTTP.HTTP2.Connection.t(),
  streams: %{optional(pos_integer()) => map()},
  refs: %{optional(reference()) => pos_integer()},
  bytes: non_neg_integer(),
  max_queue_bytes: pos_integer(),
  queue_peak_bytes: non_neg_integer(),
  wrote_preface?: boolean()
}

transport()

@type transport() :: module() | map()

Functions

acknowledge(owner, id)

Acknowledges the oldest DATA delivery after application consumption.

activate(owner)

@spec activate(pid()) :: :ok | {:error, term()}

cancel(owner, ref)

@spec cancel(pid(), reference() | pos_integer()) :: :ok | {:error, term()}

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

open_stream(owner, headers, opts \\ [])

@spec open_stream(pid(), list(), keyword()) ::
  {:ok, %{id: pos_integer(), ref: reference()}} | {:error, term()}

receive_bytes(owner, bytes)

@spec receive_bytes(pid(), binary()) :: :ok | {:error, term()}

release_stream(owner, ref)

@spec release_stream(pid(), reference() | pos_integer()) :: :ok

send_data(owner, id, data, end_stream? \\ false)

@spec send_data(pid(), pos_integer(), binary(), boolean()) :: :ok | {:error, term()}

send_event(owner, event)

@spec send_event(pid(), term()) :: :ok | {:error, term()}

start_link(opts)

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

status(owner)

@spec status(pid()) :: map()