IrohBeam.Stream (iroh_beam v0.2.0)

View Source

Bounded QUIC stream with independent send and receive halves.

Every receive requires a positive byte limit. One mutable operation may be in flight per half; conflicting calls return :busy, while opposite halves of a bidirectional stream can progress concurrently.

Summary

Types

t()

@type t() :: %IrohBeam.Stream{
  direction: :uni | :bi,
  id: non_neg_integer(),
  owner: pid(),
  recv?: boolean(),
  resource: reference(),
  send?: boolean()
}

Functions

abort(stream, code \\ 0)

@spec abort(t(), non_neg_integer()) :: :ok | {:error, IrohBeam.Error.t()}

finish(stream)

@spec finish(t()) :: :ok | {:error, IrohBeam.Error.t()}

id(stream)

@spec id(t()) :: non_neg_integer()

info(stream)

@spec info(t()) :: {:ok, map()} | {:error, IrohBeam.Error.t()}

recv(stream, max_bytes, options \\ [])

@spec recv(t(), pos_integer(), keyword()) ::
  {:ok, binary()} | :eof | {:error, IrohBeam.Error.t()}

recv_to_end(stream, hard_limit, options \\ [])

@spec recv_to_end(t(), pos_integer(), keyword()) ::
  {:ok, binary()} | {:error, IrohBeam.Error.t()}

reset(stream, code \\ 0)

@spec reset(t(), non_neg_integer()) :: :ok | {:error, IrohBeam.Error.t()}

send(stream, data, options \\ [])

@spec send(t(), binary(), keyword()) :: :ok | {:error, IrohBeam.Error.t()}

send_chunk(stream, data, options \\ [])

@spec send_chunk(t(), binary(), keyword()) ::
  {:ok, pos_integer()} | {:error, IrohBeam.Error.t()}

stop(stream, code \\ 0)

@spec stop(t(), non_neg_integer()) :: :ok | {:error, IrohBeam.Error.t()}