DocShell.Generate.Collection.Limits (DocShell v0.4.0)

Copy Markdown View Source

Finite admission budgets for loading existing collection artifacts.

Limits bound bytes before JSON decoding and bound JSON nesting before the decoder allocates its tree. Counts cover manifested files, provenance records and descriptors. These are import limits, not promises about VM memory usage or the future site renderer's output limits. A caller may explicitly raise or lower any positive limit; unlimited sentinel values are not accepted.

Summary

Types

t()

Validated positive import budgets; byte totals include the manifest.

Functions

Checks an observed resource amount against its configured maximum.

Checks JSON container nesting without allocating the decoded tree.

Validates keyword overrides and fills in finite defaults.

Types

t()

@type t() :: %{required(atom()) => pos_integer()}

Validated positive import budgets; byte totals include the manifest.

Functions

check(limits, resource, observed)

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

Checks an observed resource amount against its configured maximum.

check_depth(json, limits)

@spec check_depth(binary(), t()) :: :ok | {:error, term()}

Checks JSON container nesting without allocating the decoded tree.

new(opts)

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

Validates keyword overrides and fills in finite defaults.