# fuse::mount

> Tag 2: the client names a path and a kind; the server makes one FUSE mount there, answers Ok once it is serving, and holds the scope open for its own life, asking on channels of the scope for everything the mount needs.

Canonical: https://protocol.diverge.network/2.3.0/container-proxy-endpoints/fuse-mount/
Specification revision: 2.3.0

The client opens the scope with a request whose payload is the tag
byte `2` followed by the mount as JSON: a path and a kind. The server
makes the mount and answers with exactly one `Ok` response once the
mount is serving, and holds the scope open for as long as the server
lives; or answers with exactly one error response and the finish. The
scope is the mount: every ask the mount makes rides it, and no ask
names the mount.

- **The request.** [Request](/2.3.0/container-proxy-endpoints/fuse-mount/request/) states its form.
- **The response.** [Response](/2.3.0/container-proxy-endpoints/fuse-mount/response/) states the one response
  and what follows it.
- **The channels.** The server opens the channels that
  [Server Channels](/2.3.0/container-proxy-endpoints/fuse-mount/server/) defines. The client opens no channel
  on a mount scope.

## The order

1. **The server reads the request.** A request whose payload does not
   decode is answered by a response finish that no response precedes,
   as [Container Proxy Endpoints](/2.3.0/container-proxy-endpoints/) provides. A path that is
   the root of the container, or that has a component that is empty,
   `.`, `..`, or contains `/` or NUL, is answered by the error. A path
   at which the server already holds a mount is answered by the error.
2. **The server makes the mount point.** Every missing parent directory
   is made; a file mount's file is made if absent, with mode `0600`;
   a directory mount's directory is made if absent and given mode
   `0700`.
3. **The server mounts.** A mount the host or the kernel refuses is
   answered by the error.
4. **The server answers `Ok`.** Exactly once, once the mount is
   serving. From that moment every operation a program performs on
   the mount is one ask on a channel of this scope.
5. **The scope stays open.** The server holds the mount, and the scope,
   for its own life. It sends no response finish on a mount scope it
   answered `Ok`.

## The rules that hold throughout

- **The meaning of a mount.** What a file mount and a directory mount
  are to a program in the container, and what each ask means, the
  [containers::agents::run](/2.3.0/endpoints/containers-agents-run/) request
  and its [FUSE read](/2.3.0/endpoints/containers-agents-run/server/fuse-read/) and sibling channels
  state; this layer states only how the asks are carried.
- **When.** The client opens a mount scope at any time after the begin
  has been answered, as [Connection](/2.3.0/container-proxy/connection/)
  states: the mounts of the container's request before any other
  scope, and any further mount beside the scopes already open. A
  tree scope open when a mount is made reports what is under the
  mount's path as the filesystem shows it; a tree scope opened after
  leaves the path out when its request names it.
- **No repetition.** The server sends every ask exactly once. A channel
  that ends without a finish is not asked again, and the operation is
  reported to the program as failed.
- **No timeout.** The server imposes no timeout on any ask.
