# `Hyper.Node.Budget`
[🔗](https://github.com/harmont-dev/hyper/blob/main/lib/hyper/node/budget.ex#L1)

Public entry point for this node's resource budget. Thin facade over
`Hyper.Node.Budget.Hard`, the per-node accounting GenServer supervised by
`Hyper.Node.Budget.Supervisor`.

# `admit`

```elixir
@spec admit(Hyper.Vm.Instance.Spec.t(), pid()) :: :ok | {:error, term()}
```

Authoritatively confirm this node can run `spec`, reserving its budget for the
lifetime of `owner`. Live soft-load check first, then an atomic hard reserve.

# `can_run`

```elixir
@spec can_run(Hyper.Vm.Instance.Spec.t()) :: :ok | {:error, term()}
```

Can this node run the given vm spec? `:ok` if yes, `{:error, reason}` otherwise.

# `with_budget`

```elixir
@spec with_budget(Hyper.Vm.Instance.Spec.t(), (-&gt; result)) ::
  result | {:error, term()}
when result: var
```

Reserve the spec's budget, run `callable`, and release the budget afterwards.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
