# `FlyDeploy.BlueGreen.Sentinel`

A GenServer injected as the first child in the peer's wrapper supervisor.

OTP shuts down children in reverse order, so the sentinel terminates **last**
— after all user processes (Endpoint, Counter, PubSub, etc.) have already
run their `terminate/2` callbacks and written any handoff state.

Before calling `:init.stop()`, PeerManager arms the sentinel via `:erpc.call`.
When armed, `terminate/2` runs the `before_cutover` callback and writes
the result to the parent's handoff ETS at key `:__before_cutover_result__`.

When NOT armed (normal restarts, crashes), `terminate/2` is a no-op.

# `arm`

Arms the sentinel with a before_cutover callback. Called via `:erpc.call`
from PeerManager before `:init.stop()`.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

---

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