features

package
v0.0.0-...-c7fba9c Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flag

func Flag(tr confGetter, feature SnapdFeature) (bool, error)

Flag returns whether the given feature flag is enabled.

Types

type SnapdFeature

type SnapdFeature int

SnapdFeature is a named feature that may be on or off.

const (
	// Layouts controls availability of snap layouts.
	Layouts SnapdFeature = iota
	// ParallelInstances controls availability installing a snap multiple times.
	ParallelInstances
	// Hotplug controls availability of dynamically creating slots based on system hardware.
	Hotplug
	// SnapdSnap controls possibility of installing the snapd snap.
	SnapdSnap
	// PerUserMountNamespace controls the persistence of per-user mount namespaces.
	PerUserMountNamespace
	// RefreshAppAwareness controls refresh being aware of running applications.
	RefreshAppAwareness
	// ClassicPreservesXdgRuntimeDir controls $XDG_RUNTIME_DIR in snaps with classic confinement.
	ClassicPreservesXdgRuntimeDir
	// RobustMountNamespaceUpdates controls how snap-update-ns updates existing mount namespaces.
	RobustMountNamespaceUpdates
	// UserDaemons controls availability of user mode service support.
	UserDaemons
	// DbusActivation controls whether snaps daemons can be activated via D-Bus
	DbusActivation
	// HiddenSnapFolder moves ~/snap to ~/.snapdata.
	HiddenSnapFolder
	// CheckDiskSpaceRemove controls free disk space check on remove whenever automatic snapshot needs to be created.
	CheckDiskSpaceRemove
	// CheckDiskSpaceInstall controls free disk space check on snap install.
	CheckDiskSpaceInstall
	// CheckDiskSpaceRefresh controls free disk space check on snap refresh.
	CheckDiskSpaceRefresh
	// GateAutoRefreshHook enables refresh control from snaps via gate-auto-refresh hook.
	GateAutoRefreshHook

	// QuotaGroups enable creating resource quota groups for snaps via the rest API and cli.
	QuotaGroups
)

func KnownFeatures

func KnownFeatures() []SnapdFeature

KnownFeatures returns the list of all known features.

func (SnapdFeature) ConfigOption

func (f SnapdFeature) ConfigOption() (snapName, confName string)

ConfigOption returns the snap name and configuration option associated with this feature.

func (SnapdFeature) ControlFile

func (f SnapdFeature) ControlFile() string

ControlFile returns the path of the file controlling the exported feature.

Snapd considers the feature enabled if the file is present. The contents of the file are not important.

The function panics for features that are not exported.

func (SnapdFeature) IsEnabled

func (f SnapdFeature) IsEnabled() bool

IsEnabled checks if a given exported snapd feature is enabled.

The function panics for features that are not exported.

func (SnapdFeature) IsEnabledWhenUnset

func (f SnapdFeature) IsEnabledWhenUnset() bool

IsEnabledWhenUnset returns true if a feature is enabled when not set.

A feature may be enabled or disabled with explicit state in snapd. If explicit state is absent the effective value is the implicit default computed by this function.

func (SnapdFeature) IsExported

func (f SnapdFeature) IsExported() bool

IsExported returns true if a feature is copied from snapd state to a feature file.

Certain features are available outside of snapd internal state and visible as control files in a dedicated directory. Such features can be queried for, via IsEnabled, outside of snapd.

func (SnapdFeature) String

func (f SnapdFeature) String() string

String returns the name of a snapd feature. The function panics for bogus feature values.

Jump to

Keyboard shortcuts

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