Gitility.Limits (Gitility v0.3.0)

Copy Markdown View Source

Resource budgets for a single operation.

All operations accept limits: and merge it with these package defaults. Operation-specific options (limit:, max_bytes:, …) may lower but never raise hard runtime ceilings — passing an explicitly more permissive %Gitility.Limits{} is the only way to raise one, and that decision then sits visibly at the call site.

A job's full budget includes cache misses and provider work: bytes fetched from a backend on your behalf count against max_provider_bytes even when a later cache hit would have been free. That 256 MiB default is a query-time, per-job safety ceiling. Explicit Gitility.ODB.PackFetch hydration is a one-time bulk load and uses its separate :max_hydration_bytes option (4 GiB by default) without changing these query defaults.

When a limit stops work early, the operation still succeeds: the result carries truncated: true, a cursor when continuation is possible, and the stopping limit in its stats — truncation is surfaced, never silent.

Summary

Functions

Builds a limits profile from overrides on the package defaults.

Types

t()

@type t() :: %Gitility.Limits{
  max_delta_depth: pos_integer(),
  max_diff_files: pos_integer(),
  max_diff_hunks: pos_integer(),
  max_diff_lines: pos_integer(),
  max_object_bytes: pos_integer(),
  max_objects: pos_integer(),
  max_provider_bytes: pos_integer(),
  max_provider_requests: pos_integer(),
  max_result_bytes: pos_integer(),
  max_results: pos_integer(),
  max_total_object_bytes: pos_integer(),
  max_tree_entries: pos_integer(),
  timeout_ms: pos_integer()
}

Functions

new(overrides \\ [])

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

Builds a limits profile from overrides on the package defaults.

iex> Gitility.Limits.new(timeout_ms: 5_000).timeout_ms
5000
iex> Gitility.Limits.new().max_objects
100000