CharterAgreementProtocol.Limits (Charter Agreement Protocol v0.1.0)

Copy Markdown View Source

CAP never authorizes.

Caller-supplied ceilings for bounded protocol decoding.

Callers may narrow the defaults or widen them only as far as the compiled maximums. The values are pure data: no environment or application config is consulted.

Summary

Functions

The default bounded-decoding limits.

The closed limit-field set.

The greatest caller-selectable value for each limit.

Build caller-supplied limits, rejecting unknown or out-of-range values.

Whether a limits struct is complete and within the compiled maximums.

Types

t()

@type t() :: %CharterAgreementProtocol.Limits{
  max_array_items: non_neg_integer(),
  max_artifact_set_items: non_neg_integer(),
  max_bytes: non_neg_integer(),
  max_depth: non_neg_integer(),
  max_object_members: non_neg_integer(),
  max_string_bytes: non_neg_integer()
}

Functions

default()

@spec default() :: t()

The default bounded-decoding limits.

fields()

@spec fields() :: [atom()]

The closed limit-field set.

maximums()

@spec maximums() :: t()

The greatest caller-selectable value for each limit.

new(options \\ [])

@spec new(keyword()) :: {:ok, t()} | {:error, CharterAgreementProtocol.Error.t()}

Build caller-supplied limits, rejecting unknown or out-of-range values.

valid?(limits)

@spec valid?(term()) :: boolean()

Whether a limits struct is complete and within the compiled maximums.