local

package
v0.0.1-dev.137 Latest Latest
Warning

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

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

Documentation

Overview

Package local implements two storage Driver names that ship with the Rune binary:

  • "local" — Rune-managed directory under runefile [storage].localVolumeRoot. Owns directory lifecycle; honours reclaimPolicy: delete with bounded rm -rf; supports filesystem-level snapshots.

  • "local-host" — Operator-owned host path declared on Volume.parameters.hostPath. Validated against runefile [storage].hostPathAllowlist. Delete is a no-op; reclaimPolicy: delete is rejected. No snapshot support.

The two driver names share helpers (path validation, snapshot copy, mount target rewriting) but advertise different Capabilities. Each is its own row in the registry — there is no "subdriver" abstraction. Adding a third local-style driver would mean adding a third Register() call.

Introduced in RUNE-069.

Index

Constants

View Source
const (
	DriverNameLocal     = "local"
	DriverNameLocalHost = "local-host"
)

Driver names registered by this package.

Variables

This section is empty.

Functions

func AllowlistFromConfig

func AllowlistFromConfig(raw map[string]any) []string

AllowlistFromConfig extracts the hostPathAllowlist entries from a raw runefile config map (the same shape consumed by factoryHost). Returns nil for missing/empty/malformed entries — never errors. Exported so the API server can read the allowlist without round-tripping through driver instantiation.

func IsHostPathAllowed

func IsHostPathAllowed(abs string, allowlist []string) bool

IsHostPathAllowed reports whether abs is inside any prefix in allowlist. Each prefix is resolved with filepath.Abs and compared with proper path-segment semantics (so /var/lib/rune/volumes2 does NOT match a /var/lib/rune/volumes prefix).

Exported so the API server can perform the same cast-time check the driver performs at provision time, without instantiating the driver.

Types

type Config

type Config struct {
	// LocalVolumeRoot is the parent directory the "local" driver creates
	// per-volume directories under. Defaults to /var/lib/rune/volumes when
	// empty.
	LocalVolumeRoot string

	// HostPathAllowlist is the set of allowed host-path prefixes for the
	// "local-host" driver. Empty allowlist denies every host path (safe
	// default).
	HostPathAllowlist []string

	// AllowCreateMissing, when true, lets the "local-host" driver auto-mkdir
	// host paths that don't exist (still subject to the allowlist). Default
	// false; runed --dev-mode flips this on for ~/.rune/volumes only.
	AllowCreateMissing bool

	// PreserveOnDelete converts reclaimPolicy: delete into retain for the
	// "local" (managed) driver. Belt-and-braces for operators who want
	// cascade-delete to never wipe data. local-host is unaffected (it
	// already rejects reclaimPolicy: delete).
	PreserveOnDelete bool

	// SnapshotRoot is the parent directory snapshots are stored under for
	// the "local" driver. Defaults to <LocalVolumeRoot>/.snapshots.
	SnapshotRoot string
}

Config is the runefile [storage] section the factory consumes.

Jump to

Keyboard shortcuts

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