Quic.CryptoReassembly (elixir_quic v0.16.7)

Copy Markdown View Source

Bounded sparse storage for one QUIC CRYPTO stream.

Offsets are absolute and the store never allocates a buffer proportional to a future offset. Overlapping bytes must agree; once bytes are delivered they are removed and cannot be delivered twice.

Summary

Types

initial_state()

@type initial_state() :: %Quic.CryptoReassembly{
  buffered_bytes: 0,
  intervals: [],
  max_bytes: term(),
  max_intervals: term(),
  next: 0
}

t()

@type t() :: %Quic.CryptoReassembly{
  buffered_bytes: term(),
  intervals: term(),
  max_bytes: term(),
  max_intervals: term(),
  next: term()
}

Functions

buffered_bytes(crypto_reassembly)

@spec buffered_bytes(t()) :: non_neg_integer()

intervals(crypto_reassembly)

@spec intervals(t()) :: [{non_neg_integer(), binary()}]

new(opts \\ [])

@spec new(keyword()) :: initial_state()

next_offset(crypto_reassembly)

@spec next_offset(t()) :: non_neg_integer()

put(state, offset, bytes)

@spec put(t(), non_neg_integer(), binary()) :: {:ok, t(), binary()} | {:error, atom()}

Insert a sparse range and return newly contiguous bytes, if any.