HTTP.Runtime.Stream (http_runtime v0.16.0)

View Source

Internal logical HTTP/2 byte stream. The supervised stream task owns admission and its reservation for its entire lifetime; the connection owner alone owns the transport. Notifications are qualified by an opaque attempt generation. DATA acknowledgements settle transport credit after bounded parser admission. They are independent from application delivery acknowledgements. Subscribers must monitor the returned task PID: a shared-runtime restart terminates tasks, and its DOWN notification is the terminal signal when forwarding is unavailable. Ordinary remote end releases after all DATA transport references are settled. Extended CONNECT retains its reservation until both directions end or the adapter cancels. Adapters submit one bounded write at a time and await :done before another submission; progress reports transport-accepted bytes.

Summary

Functions

Settles the oldest DATA notification after bounded parser admission.

Cancels only this stream; repeated cancellation is harmless.

Half-closes the local tunnel direction after the previous write completes.

Submits one bounded write; progress is reported with the returned reference.

Types

handle()

@type handle() :: %{
  owner: pid(),
  id: pos_integer(),
  ref: reference(),
  protocol: :h2 | :h2c
}

Functions

acknowledge(stream, delivery_ref)

Settles the oldest DATA notification after bounded parser admission.

close(stream)

Cancels only this stream; repeated cancellation is harmless.

half_close(stream)

Half-closes the local tunnel direction after the previous write completes.

start(request, subscriber, opts \\ [])

@spec start(HTTP.Request.t(), pid(), keyword()) ::
  {:ok, pid(), reference()} | {:error, term()}

write(stream, bytes, end_stream? \\ false)

Submits one bounded write; progress is reported with the returned reference.