QuicHttp3.Transport behaviour (elixir_quic_http3 v1.0.0)

Copy Markdown View Source

Narrow transport contract consumed by the HTTP/3 session layer.

Implementations provide QUIC operations only. HTTP/3 frame parsing, QPACK, control streams, and request streams remain in QuicHttp3.

Operation options may carry deadline: {:abs_ms, monotonic_milliseconds}. Session retains the same absolute deadline across blocked or unknown work. open_stream/3 options may carry reliable_prefix: bytes; transports that support reliable reset answer a peer STOP_SENDING on that stream with RESET_STREAM_AT retaining the prefix, and others may ignore the option. migrate/2 (optional) forwards explicit client migration of an exclusive standalone connection; it returns the engine admission {:ok, ref} and the outcome later arrives as the {:migration, ref, outcome} event. Connections on a shared endpoint refuse with {:error, :shared_endpoint}. The internal exclusive cleanup descriptor is supported only by a Session using the production Quic adapter and an owned endpoint. Cleanup acknowledgements do not replace the separately retained Quic.Cleanup receipt.

Summary

Types

connection()

@type connection() :: term()

failure()

@type failure() :: {:error, term()} | {:blocked, term()} | {:unknown, reference()}

options()

@type options() :: keyword()

stream()

@type stream() :: term()

Callbacks

abort(connection, options)

@callback abort(connection(), options()) :: :ok | failure()

capabilities()

@callback capabilities() :: map()

cleanup(connection)

@callback cleanup(connection()) :: :ok | {:error, term()}

client(options)

@callback client(options()) :: {:ok, term()} | failure()

close(connection, non_neg_integer, binary, options)

@callback close(connection(), non_neg_integer(), binary(), options()) :: :ok | failure()

connect(arg1, port_number, options)

@callback connect(binary() | :inet.ip_address(), :inet.port_number(), options()) ::
  {:ok, connection()} | {:unknown, connection(), reference()} | failure()

events(connection, pos_integer, options)

@callback events(connection(), pos_integer(), options()) :: {:ok, list()} | failure()

info(connection)

@callback info(connection()) :: {:ok, map()} | failure()

migrate(connection, options)

(optional)
@callback migrate(connection(), options()) :: {:ok, reference()} | failure()

open_stream(connection, arg2, options)

@callback open_stream(connection(), :bidi | :uni, options()) ::
  {:ok, stream()} | failure()

operation_status(connection, reference, atom)

@callback operation_status(connection(), reference(), atom()) ::
  map() | :unknown | failure()

read(stream, pos_integer, options)

@callback read(stream(), pos_integer(), options()) :: {:ok, list()} | failure()

read_datagrams(connection, pos_integer, options)

@callback read_datagrams(connection(), pos_integer(), options()) ::
  {:ok, [binary()]} | failure()

ready(connection, timeout)

@callback ready(connection(), timeout()) :: :ready | :pending | failure()

reset_stream(stream, non_neg_integer, options)

@callback reset_stream(stream(), non_neg_integer(), options()) ::
  {:ok, reference()} | :ok | failure()

reset_stream_at(stream, non_neg_integer, non_neg_integer, options)

@callback reset_stream_at(stream(), non_neg_integer(), non_neg_integer(), options()) ::
  {:ok, reference()} | :ok | failure()

send_datagram(connection, binary, options)

@callback send_datagram(connection(), binary(), options()) ::
  {:ok, reference()} | failure()

send_stream(stream, binary, boolean, options)

@callback send_stream(stream(), binary(), boolean(), options()) ::
  {:ok, reference()} | :ok | failure()

stop_endpoint(pid)

@callback stop_endpoint(pid()) :: :ok | {:error, term()}

stop_stream(stream, non_neg_integer, options)

@callback stop_stream(stream(), non_neg_integer(), options()) ::
  {:ok, reference()} | :ok | failure()