adapters

package
v0.7.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package adapters describes how to invoke external mount tools on the host for each supported storage protocol. The adapters are pure: they translate a MountSpec into a Plan describing what to run. The mounts.Manager owns process spawning, credential-file lifecycle, and supervision.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adapters

func Adapters() map[models.MountType]Adapter

Adapters returns the default adapter map keyed by mount type.

Types

type Adapter

type Adapter interface {
	// Build produces a Plan from a user-supplied MountSpec, given the host
	// path the mount should land on. sandboxID and index are passed in so
	// the adapter can place its credentials file at a stable, per-mount path.
	Build(sandboxID string, index int, spec models.MountSpec, hostTarget, credDir string) (Plan, error)
}

Adapter is the interface every supported mount type implements.

type NFS

type NFS struct{}

NFS uses the kernel mount(2) syscall via /bin/mount; there is no long-running user-space process to supervise. The manager runs `mount -t nfs ...` once, waits for it to exit (it returns immediately on success), then registers a periodic health check via findmnt.

func (NFS) Build

func (NFS) Build(sandboxID string, index int, spec models.MountSpec, hostTarget, credDir string) (Plan, error)

type Plan

type Plan struct {
	// Argv is the full command line, beginning with the binary path or name.
	Argv []string
	// Env is the environment for the spawned process. Empty means inherit
	// sandboxd's env.
	Env []string
	// CredFile is the absolute path the manager should write CredBody to with
	// mode 0600 before spawning. Empty means no credentials file.
	CredFile string
	// CredBody is the bytes the manager should write to CredFile.
	CredBody []byte
	// UnlinkCred indicates whether the manager should unlink CredFile after
	// the mount becomes ready. FUSE tools typically read credentials once at
	// startup and keep them in memory; sshfs may re-read on reconnect, so
	// that adapter sets UnlinkCred=false.
	UnlinkCred bool
	// IsKernelMount reports whether this mount type uses a kernel mount(2)
	// (no long-running user-space process). Manager skips supervision for
	// these and falls back to periodic health checks.
	IsKernelMount bool
}

Plan tells the manager exactly what to run on the host for one mount entry. It does not actually spawn anything; that is the manager's job.

type Rclone

type Rclone struct{}

Rclone mounts any rclone-supported remote using the user-supplied rclone.conf as a credentials file. The config is unlinked after the mount becomes ready; rclone keeps it in memory.

func (Rclone) Build

func (Rclone) Build(sandboxID string, index int, spec models.MountSpec, hostTarget, credDir string) (Plan, error)

type S3

type S3 struct{}

S3 mounts an S3-compatible bucket using AWS's mountpoint-s3 binary. Credentials are written as an AWS shared-credentials profile file the binary reads at startup; the file is unlinked once the mount is ready.

func (S3) Build

func (S3) Build(sandboxID string, index int, spec models.MountSpec, hostTarget, credDir string) (Plan, error)

type SSHFS

type SSHFS struct{}

SSHFS mounts a remote directory over SSH using the user-supplied private key. The key file lives in the credentials directory for the lifetime of the mount; sshfs may re-read it on reconnect, so we do not unlink it after the mount becomes ready.

func (SSHFS) Build

func (SSHFS) Build(sandboxID string, index int, spec models.MountSpec, hostTarget, credDir string) (Plan, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL