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

GenServer representing a single active image on this node.

On start it resolves the image's layer chain, acquires each `Layer.Server`
(keeping the loop devices mounted), and assembles them into a single read-only
block device by stacking dm-snapshot targets (base at the bottom, each delta's
exception store layered on top). `blk_path/1` returns that composed device.

Reference-counted via process monitors, like `Layer.Server`: holders `acquire/1`
it; when the last leaves it idle-reaps, removing its dm chain in `terminate/2`
and releasing its layers (which then unmount once nothing else holds them).

# `acquire`

```elixir
@spec acquire(GenServer.server()) :: :ok
```

Take a reference on `server` on behalf of the calling process. The image stays
assembled until every holder releases (or dies). Idempotent per process.

# `blk_path`

```elixir
@spec blk_path(GenServer.server()) :: Path.t()
```

The composed read-only block device path for the image managed by `server`.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `layers`

```elixir
@spec layers(GenServer.server()) :: [Hyper.Layer.id()]
```

The ordered layer ids that compose the image managed by `server`.

# `release`

```elixir
@spec release(GenServer.server()) :: :ok
```

Drop the calling process's reference on `server`.

# `start_link`

```elixir
@spec start_link(Hyper.Node.Img.Server.Opts.t()) :: GenServer.on_start()
```

Start an image server for `opts`, registered by image id.

---

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