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
- func BinaryPath(installRoot, pluginName string, majorVersion int) string
- func ContractFile(installRoot, pluginName string) string
- func ContractsDir(installRoot string) string
- func CurrentLinkPath(installRoot, pluginName string) string
- func HomeFallbackPath() (string, error)
- func InstallLockPath(installRoot, pluginName string) string
- func InstalledNames(root string) ([]string, error)
- func PluginDir(installRoot, pluginName string) string
- func PluginsRoot(installRoot string) string
- func ResolveInstallRoot(configured string) (string, bool)
- func ResolveInstalled(configured string) (string, []string, bool)
- func RootHasInstall(root string) bool
- func ValidatePluginName(name string) error
- func VersionDir(installRoot, pluginName string, majorVersion int) string
Constants ¶
const ( ContractFileExt = ".json" VersionDirPrefix = "v" )
Variables ¶
This section is empty.
Functions ¶
func BinaryPath ¶
BinaryPath returns <installRoot>/plugins/<pluginName>/v<majorVersion>/<pluginName>.
func ContractFile ¶
ContractFile returns <installRoot>/cache/contracts/<pluginName>.json.
func ContractsDir ¶
ContractsDir returns <installRoot>/cache/contracts.
func CurrentLinkPath ¶
CurrentLinkPath returns <installRoot>/plugins/<pluginName>/current - the symlink to the currently active binary version.
func HomeFallbackPath ¶
HomeFallbackPath returns ~/.deckhouse-cli - the fallback install root used when the default /opt path is not writable.
func InstallLockPath ¶
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 InstalledNames ¶ added in v0.33.15
InstalledNames returns the names of the plugins installed under <root>/plugins - the directories carrying 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 PluginsRoot ¶
PluginsRoot returns <installRoot>/plugins.
func ResolveInstallRoot ¶ added in v0.33.15
ResolveInstallRoot reports just the root resolved by ResolveInstalled.
func ResolveInstalled ¶ added in v0.33.15
ResolveInstalled reports the plugins root that actually holds an install, the plugin names in it, and whether one was found: the configured root, or the home fallback (~/.deckhouse-cli) that EnsureInstallRoot switches to when the configured one is not writable. The final result is false when no plugins are installed anywhere, and the root is then empty and the names nil.
Callers resolving a plugin by name must use this rather than the configured root alone: with an unwritable default root the installs live in the fallback, and looking only at the configured root would miss every one of them.
func RootHasInstall ¶
RootHasInstall reports whether <root>/plugins holds at least one installed plugin.
func ValidatePluginName ¶ added in v0.33.8
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 ¶
VersionDir returns <installRoot>/plugins/<pluginName>/v<majorVersion>.
Types ¶
This section is empty.