# `BeamDeploy.HotUpgrader`
[🔗](https://github.com/Valian/beam_deploy/blob/v0.1.0/lib/beam_deploy/hot_upgrader.ex#L1)

In-process hot upgrades from local `mix release` tarballs.

This path reloads code inside the currently running node instead of starting
a replacement peer. It is intended for compatible code changes only.

Hot upgrades are appropriate when:

- processes can survive `code_change/3`
- the supervision tree shape is unchanged
- the running node and tarball use the same Erlang/OTP version

Hot upgrades are not supported for:

- supervision tree topology changes
- Erlang/OTP upgrades
- NIF upgrades
- major runtime config topology changes

# `upgrade_stats`

```elixir
@type upgrade_stats() :: %{
  copied_modules: non_neg_integer(),
  copied_new_modules: non_neg_integer(),
  copied_consolidated_protocols: non_neg_integer(),
  module_names: [String.t()],
  modules_reloaded: non_neg_integer(),
  process_failures: [map()],
  process_names: [String.t()],
  processes_failed: non_neg_integer(),
  processes_skipped: non_neg_integer(),
  processes_succeeded: non_neg_integer(),
  skipped_nif_modules: [module()],
  suspend_duration_ms: non_neg_integer()
}
```

# `hot_upgrade`

```elixir
@spec hot_upgrade(Path.t(), atom(), keyword()) ::
  {:ok, upgrade_stats()} | {:error, term()}
```

Applies a hot upgrade from a local release tarball.

## Options

- `:suspend_timeout` - timeout in milliseconds for suspending each process
  before code change, defaults to `3000`

---

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