GenServer responsible for managing a single mounted layer.
Reference-counted via process monitors: each holder acquire/1s the layer and
the server monitors it, so a holder that crashes is released automatically (no
leaked count). When the last holder goes away the server waits a short idle
grace period and then stops, unmounting the block device in terminate/2. The
grace period keeps bursty acquire/release cycles from thrashing the mount.
Summary
Functions
Take a reference on server on behalf of the calling process. The layer stays
mounted until every holder releases (or dies). Idempotent per process.
Get the block device path of the layer managed by server.
Returns a specification to start this module under a supervisor.
Get the server mounting layer_id, starting it under the layer supervisor if needed.
Drop the calling process's reference on server.
Create a new layer, mounting it as a block device.
Functions
@spec acquire(GenServer.server()) :: :ok
Take a reference on server on behalf of the calling process. The layer stays
mounted until every holder releases (or dies). Idempotent per process.
@spec blk_path(GenServer.server()) :: Path.t()
Get the block device path of the layer managed by server.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec for_layer(Hyper.Layer.id()) :: {:ok, pid()} | {:error, term()}
Get the server mounting layer_id, starting it under the layer supervisor if needed.
@spec release(GenServer.server()) :: :ok
Drop the calling process's reference on server.
@spec start_link(Hyper.Node.Layer.Server.Opts.t()) :: GenServer.on_start()
Create a new layer, mounting it as a block device.