WardrikLua.Sandbox.Limits (wardrik_lua v0.1.0-rc.1)

Copy Markdown

Bounds for one evaluation.

WardrikLua.Sandbox.Limits.new(timeout_ms: :timer.seconds(5), max_steps: 1_000_000)
FieldDefaultBounds
:timeout_ms30show long the evaluation may run
:max_heap_bytes64 MBmemory the evaluating process may hold
:max_steps10Moperations the code may execute
:max_depth200nested calls the code may make

Set any field to :infinity to lift that limit.

Summary

Types

A bound, or :infinity for none.

t()

Bounds for one evaluation.

Functions

Returns limits, with defaults for fields not given.

Types

limit()

@type limit() :: pos_integer() | :infinity

A bound, or :infinity for none.

t()

@type t() :: %WardrikLua.Sandbox.Limits{
  max_depth: limit(),
  max_heap_bytes: limit(),
  max_steps: limit(),
  timeout_ms: limit()
}

Bounds for one evaluation.

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Returns limits, with defaults for fields not given.

Raises KeyError on an unknown field, and ArgumentError on a bound that isn't a positive integer or :infinity.