Limits and mode for a CRAM reader.
:strict fails on checksum mismatches and on an unknown method byte.
:permissive still refuses truncated headers and
oversized allocations. It records an unknown block method and continues
walking containers. Neither mode rewrites bytes.
Summary
Functions
Build options from a keyword list.
Types
@type t() :: %CRAM.Options{ max_block_bytes: pos_integer(), max_blocks: pos_integer(), max_container_bytes: pos_integer(), max_header_bytes: pos_integer(), max_landmarks: pos_integer(), mode: :strict | :permissive }
Reader limits.
:mode—:strictor:permissive:max_container_bytes— largest container body that will be read:max_block_bytes— largest declared block size that will be accepted:max_blocks— largest block count in one container:max_landmarks— largest landmark count in one container:max_header_bytes— largest SAM header that will be inflatediex> {:ok, options} = CRAM.Options.parse([]) iex> options.mode :strict
Functions
@spec parse(keyword()) :: {:ok, t()} | {:error, CRAM.Error.t()}
Build options from a keyword list.
Omitted keys use the defaults: :strict, 64 MiB containers, 64 MiB blocks,
100_000 blocks, 100_000 landmarks, and a 16 MiB header. Unknown keys are
ignored. Returns {:ok, options}. :mode other than :strict or
:permissive, or a value that is not a keyword list, is
reason: :invalid_range. Does not raise.
iex> {:ok, options} = CRAM.Options.parse(mode: :permissive, max_block_bytes: 1024)
iex> {options.mode, options.max_block_bytes}
{:permissive, 1024}
iex> {:error, error} = CRAM.Options.parse(mode: :loose)
iex> error.reason
:invalid_range
iex> {:error, bad} = CRAM.Options.parse(%{})
iex> bad.reason
:invalid_range