Tahr.Mount.Handler (tahr v0.1.0)

Copy Markdown View Source

ONC RPC handler for MOUNT v3 (program 100005, version 3) — see RFC 1813 appendix I.

Implements the six MOUNT v3 procedures:

ProcName
0NULL
1MNT
2DUMP
3UMNT
4UMNTALL
5EXPORT

Export resolution is delegated to a Tahr.Mount.Backend module; the handler stays storage-agnostic.

Wiring

Pass the backend module via the dispatcher's program registry using with_backend/1:

programs = %{100_005 => %{3 => Tahr.Mount.Handler.with_backend(MyBackend)}}

with_backend/1 returns a tiny shim module that conforms to the Tahr.RPC.Handler callback and stamps MyBackend into the call's ctx so the dispatcher's stateless invocation can still reach the backend.

Alternatively, set :nfs_mount_backend on the dispatcher ctx and invoke this module directly — used by the test suite.

Summary

Functions

MOUNT program number (always 100005).

MOUNT version this handler implements (always 3).

Build a thin handler module that dispatches to backend. Since Tahr.RPC.Dispatcher only carries module references, this generates a tiny anonymous-named module per backend that delegates back into this module's handle_call/4 with the backend stashed in ctx.

Functions

program()

@spec program() :: 100_005

MOUNT program number (always 100005).

version()

@spec version() :: 3

MOUNT version this handler implements (always 3).

with_backend(backend)

@spec with_backend(module()) :: module()

Build a thin handler module that dispatches to backend. Since Tahr.RPC.Dispatcher only carries module references, this generates a tiny anonymous-named module per backend that delegates back into this module's handle_call/4 with the backend stashed in ctx.