Documentation ¶
Index ¶
- func All(tr confGetter) map[string]FeatureInfo
- func Flag(tr confGetter, feature SnapdFeature) (bool, error)
- type FeatureInfo
- type SnapdFeature
- func (f SnapdFeature) ConfigOption() (snapName, confName string)
- func (f SnapdFeature) ControlFile() string
- func (f SnapdFeature) IsEnabled() bool
- func (f SnapdFeature) IsEnabledWhenUnset() bool
- func (f SnapdFeature) IsExported() bool
- func (f SnapdFeature) IsSupported() (supported bool, whyNot string)
- func (f SnapdFeature) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All(tr confGetter) map[string]FeatureInfo
All returns a map from feature flags to information about that feature.
In particular, the information contains whether the feature is supported and/or enabled. If the feature is not supported, it should also contain a reason describing why the feature is not supported. If a feature's value is not set to true or false, it is excluded from the list, since it is not in this case considered to be a feature flag.
func Flag ¶
func Flag(tr confGetter, feature SnapdFeature) (bool, error)
Flag returns whether the given feature flag is enabled.
Types ¶
type FeatureInfo ¶
type FeatureInfo struct { Supported bool `json:"supported"` UnsupportedReason string `json:"unsupported-reason,omitempty"` Enabled bool `json:"enabled"` }
FeatureInfo records whether a particular feature is supported and/or enabled.
If the feature is not supported, it should also contain a reason describing why the feature is not supported. A feature is enabled if its feature flag is set to true, regardless of whether or not it is supported.
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 // HiddenSnapDataHomeDir controls if the snaps' data dir is ~/.snap/data instead of ~/snap HiddenSnapDataHomeDir // MoveSnapHomeDir controls whether snap user data under ~/snap (or ~/.snap/data) can be moved to ~/Snap. MoveSnapHomeDir // 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 enables any current experimental features related to the Quota Groups API, on top of the features // already graduated past experimental: // * journal quotas are still experimental // while guota groups creation and management and memory, cpu, quotas are no longer experimental. QuotaGroups // RefreshAppAwarenessUX enables experimental UX improvements for refresh-app-awareness. RefreshAppAwarenessUX // Registries enables experimental configuration based on registries and views. Registries // AppArmorPrompting enables AppArmor to prompt the user for permission when apps perform certain operations. AppArmorPrompting )
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) IsSupported ¶
func (f SnapdFeature) IsSupported() (supported bool, whyNot string)
IsSupported returns true if the feature's supported callback returns true, or if it has no supportedCallback. If the feature is unsupported, the returned string details as to why.
func (SnapdFeature) String ¶
func (f SnapdFeature) String() string
String returns the name of a snapd feature. The function panics for bogus feature values.