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

The per-VM mutable rootfs. On start it activates (or reuses) the image's
read-only `Img.Server`, takes a reference on it, reads the composed device's
size, and asks the node `ThinPool` for a thin volume with that device as a
read-only external origin. `blk_path/1` is the mutable host device the VM
boots from (staged into the jail by `mknod` from this path).

Mutable layers live in their own `DynamicSupervisor`, separate from the shared
read-only `Img.Server`s; the firecracker VM is handed this layer directly and
cannot be booted from a bare `Hyper.Img`.

Monitor-refcounted like `Img.Server`/`Layer.Server`: the VM supervisor holds
it; when the last holder dies it idle-reaps, destroying its thin volume in
`terminate/2` and releasing the image (which, if it was the last holder, tears
down the RO chain in turn).

# `acquire`

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

# `acquire`

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

# `active_vm_ids`

```elixir
@spec active_vm_ids() :: [Hyper.Vm.Id.t()]
```

vm_ids of every live mutable layer on this node.

# `blk_path`

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

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `describe`

```elixir
@spec describe(GenServer.server()) :: %{
  img_id: Hyper.Img.id(),
  thin_name: String.t(),
  thin_id: non_neg_integer(),
  blk_path: Path.t(),
  origin_dev: Path.t()
}
```

The volume's identity for forking: which image it serves, its thin name/id in
the node pool, its device path, and the composed RO origin it reads through.

# `release`

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

Release the calling process's hold on the writable volume.

The VM-supervisor holder is released via its monitor :DOWN, not this function.

# `start_link`

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

---

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