featuregate

package
v0.0.0-...-e3e1183 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// Values for PreRelease.
	Alpha = prerelease("ALPHA")
	Beta  = prerelease("BETA")
	GA    = prerelease("")
)

Variables

View Source
var (
	// DefaultMutableFeatureGate is a mutable version of DefaultFeatureGate.
	// Only top-level commands/options setup should make use of this.
	DefaultMutableFeatureGate MutableFeatureGate = NewFeatureGate()

	// DefaultFeatureGate is a shared global FeatureGate.
	// Top-level commands/options setup that needs to modify this feature gate should use DefaultMutableFeatureGate.
	DefaultFeatureGate FeatureGate = DefaultMutableFeatureGate
)

Functions

func NewFeatureGate

func NewFeatureGate() *defaultFeatureGate

Types

type Feature

type Feature string
const (
	// owner: @zewen
	// alpha:
	// beta:
	XdsMtlsEnable Feature = "XdsMtlsEnable"

	// owner @zewen
	// alpha:
	// beta:
	PayLoadLimitEnable Feature = "PayLoadLimitEnable"

	// owner: @zewen
	// alpha:
	// beta:
	MultiTenantMode Feature = "MultiTenantMode"
)

type FeatureGate

type FeatureGate interface {
	// Enabled returns true if the key is enabled.
	Enabled(key Feature) bool
	// KnownFeatures returns a slice of strings describing the FeatureGate's known features.
	KnownFeatures() []string
	// DeepCopy returns a deep copy of the FeatureGate object, such that gates can be
	// set on the copy without mutating the original. This is useful for validating
	// config against potential feature gate changes before committing those changes.
	DeepCopy() MutableFeatureGate

	// IsReady returns true if the feature is ready
	IsReady(key Feature) bool
	// Subscribe returns a channel. if the channel is closed, means the feature is ready
	Subscribe(key Feature) (chan struct{}, error)
	// UpdateToReady supports updating feature to ready, then closing the channel
	// unsupported:
	// 1. Rollback the notified of ready to false or Setting with false
	// 2. Repeat setting the notified of ready with true
	UpdateToReady(key Feature) error
}

FeatureGate indicates whether a given feature is enabled or not

type FeatureSpec

type FeatureSpec struct {
	// Default is the default enablement state for the feature
	Default bool
	// LockToDefault indicates that the feature is locked to its default and cannot be changed
	LockToDefault bool
	// PreRelease indicates the maturity level of the feature
	PreRelease prerelease
}

type MutableFeatureGate

type MutableFeatureGate interface {
	FeatureGate

	// AddFlag adds a flag for setting global feature gates to the specified FlagSet.
	AddFlag(fs *pflag.FlagSet)
	// Set parses and stores flag gates for known features
	// from a string like feature1=true,feature2=false,...
	Set(value string) error
	// SetFromMap stores flag gates for known features from a map[string]bool or returns an error
	SetFromMap(m map[string]bool) error
	// Add adds features to the featureGate.
	Add(features map[Feature]FeatureSpec) error
}

MutableFeatureGate parses and stores flag gates for known features from a string like feature1=true,feature2=false,...

Jump to

Keyboard shortcuts

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