DocShell.Presentation.Limits (DocShell v0.5.0)

Copy Markdown View Source

Finite resource ceilings for site projection and static export.

Hosts may lower or explicitly raise a ceiling with a positive integer. There is no unlimited sentinel. Limit errors name the resource, observed value and admitted maximum.

Summary

Types

t()

Validated site resource ceilings.

Functions

Checks one observed resource count against the corresponding ceiling.

Builds a limits value from a closed keyword list of positive integers.

Accepts an existing limits value or validates a keyword override list.

Types

t()

@type t() :: %DocShell.Presentation.Limits{
  max_ast_depth: pos_integer(),
  max_collections: pos_integer(),
  max_file_bytes: pos_integer(),
  max_identity_bytes: pos_integer(),
  max_navigation_depth: pos_integer(),
  max_output_bytes: pos_integer(),
  max_output_files: pos_integer(),
  max_page_bytes: pos_integer(),
  max_pages: pos_integer(),
  max_redirects: pos_integer(),
  max_route_bytes: pos_integer()
}

Validated site resource ceilings.

Functions

check(limits, resource, observed)

@spec check(t(), atom(), non_neg_integer()) :: :ok | {:error, term()}

Checks one observed resource count against the corresponding ceiling.

new(opts \\ [])

@spec new(keyword()) :: {:ok, t()} | {:error, term()}

Builds a limits value from a closed keyword list of positive integers.

normalize(limits)

@spec normalize(t() | keyword()) :: {:ok, t()} | {:error, term()}

Accepts an existing limits value or validates a keyword override list.