Help us shape the future of Go! Take the 2026 Go Developer Survey

layout

package
v0.33.11 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package layout centralizes the on-disk filesystem layout used by the d8 plugins subsystem: directory names, suffixes, and helpers that build concrete paths from the install root.

The install root is the on-disk directory under which the subsystem keeps everything it owns - installed plugin binaries (<root>/plugins/...) and cached contracts (<root>/cache/contracts/...). It is supplied by the caller (typically the plugins.Manager directory, sourced from --plugins-dir, with default /opt/deckhouse/lib/deckhouse-cli, or ~/.deckhouse-cli as fallback).

Callers should use the builder functions (PluginDir, BinaryPath, ...) for full paths; the directory-name segments are package-private.

Index

Constants

View Source
const (
	ContractFileExt = ".json"

	VersionDirPrefix = "v"
)

Variables

This section is empty.

Functions

func BinaryPath

func BinaryPath(installRoot, pluginName string, majorVersion int) string

BinaryPath returns <installRoot>/plugins/<pluginName>/v<majorVersion>/<pluginName>.

func ContractFile

func ContractFile(installRoot, pluginName string) string

ContractFile returns <installRoot>/cache/contracts/<pluginName>.json.

func ContractsDir

func ContractsDir(installRoot string) string

ContractsDir returns <installRoot>/cache/contracts.

func CurrentLinkPath

func CurrentLinkPath(installRoot, pluginName string) string

CurrentLinkPath returns <installRoot>/plugins/<pluginName>/current - the symlink to the currently active binary version.

func HomeFallbackPath

func HomeFallbackPath() (string, error)

HomeFallbackPath returns ~/.deckhouse-cli - the fallback install root used when the default /opt path is not writable.

func InstallLockPath

func InstallLockPath(installRoot, pluginName string) string

InstallLockPath returns <installRoot>/plugins/<pluginName>/install.lock - one lock per plugin (not per major): installs of different majors still contend on the shared `current` symlink and contract cache, so they must serialize.

func PluginDir

func PluginDir(installRoot, pluginName string) string

PluginDir returns <installRoot>/plugins/<pluginName>.

func PluginsRoot

func PluginsRoot(installRoot string) string

PluginsRoot returns <installRoot>/plugins.

func RootHasInstall

func RootHasInstall(root string) bool

RootHasInstall reports whether <root>/plugins holds at least one installed plugin - a directory with a `current` symlink. Requiring the symlink (not just any subdir) means a leftover empty v<major> dir from a failed install does not count as an install. The cache dir is a sibling, never miscounted.

func ValidatePluginName added in v0.33.8

func ValidatePluginName(name string) error

ValidatePluginName guards a plugin name from any external source (user input, registry catalog, plugin contract) before it becomes a filesystem path or a registry route.

func VersionDir

func VersionDir(installRoot, pluginName string, majorVersion int) string

VersionDir returns <installRoot>/plugins/<pluginName>/v<majorVersion>.

Types

This section is empty.

Jump to

Keyboard shortcuts

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