feature

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Alpha features are disabled by default. They do not guarantee any backwards compatibility and may change in arbitrary ways between restic versions.
	Alpha state = "alpha"
	// Beta features are enabled by default. They may still change, but incompatible changes should be avoided.
	Beta state = "beta"
	// Stable features are always enabled
	Stable state = "stable"
	// Deprecated features are always disabled
	Deprecated state = "deprecated"
)

Variables

View Source
var Flag = New()

Flag is named such that checking for a feature uses `feature.Flag.Enabled(feature.ExampleFeature)`.

Functions

func TestSetFlag

func TestSetFlag(t *testing.T, f *FlagSet, flag FlagName, value bool) func()

TestSetFlag temporarily sets a feature flag to the given value until the returned function is called.

Usage ``` defer TestSetFlag(t, features.Flags, features.ExampleFlag, true)() ```

Types

type FlagDesc

type FlagDesc struct {
	Type        state
	Description string
}

type FlagName

type FlagName string
const (
	BackendErrorRedesign    FlagName = "backend-error-redesign"
	DeprecateLegacyIndex    FlagName = "deprecate-legacy-index"
	DeprecateS3LegacyLayout FlagName = "deprecate-s3-legacy-layout"
	DeviceIDForHardlinks    FlagName = "device-id-for-hardlinks"
	ExplicitS3AnonymousAuth FlagName = "explicit-s3-anonymous-auth"
	SafeForgetKeepTags      FlagName = "safe-forget-keep-tags"
)

flag names are written in kebab-case

type FlagSet

type FlagSet struct {
	// contains filtered or unexported fields
}

func New

func New() *FlagSet

func (*FlagSet) Apply

func (f *FlagSet) Apply(flags string, logWarning func(string)) error

func (*FlagSet) Enabled

func (f *FlagSet) Enabled(name FlagName) bool

func (*FlagSet) List

func (f *FlagSet) List() []Help

func (*FlagSet) SetFlags

func (f *FlagSet) SetFlags(flags map[FlagName]FlagDesc)

type Help

type Help struct {
	Name        string
	Type        string
	Default     bool
	Description string
}

Help contains information about a feature.

Jump to

Keyboard shortcuts

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