Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FlagValue
deprecated
type Gate ¶
type Gate struct {
// contains filtered or unexported fields
}
Gate is an immutable object that is owned by the Registry and represents an individual feature that may be enabled or disabled based on the lifecycle state of the feature and CLI flags specified by the user.
func (*Gate) Description ¶
Description returns the description for the Gate.
func (*Gate) ReferenceURL ¶
ReferenceURL returns the URL to the contextual information about the Gate.
func (*Gate) RemovalVersion ¶
RemovalVersion returns the removal version information for Gate's in StageStable.
type RegisterOption ¶ added in v0.71.0
type RegisterOption interface {
// contains filtered or unexported methods
}
RegisterOption allows to configure additional information about a Gate during registration.
func WithRegisterDescription ¶
func WithRegisterDescription(description string) RegisterOption
WithRegisterDescription adds description for the Gate.
func WithRegisterReferenceURL ¶
func WithRegisterReferenceURL(url string) RegisterOption
WithRegisterReferenceURL adds a URL that has all the contextual information about the Gate.
func WithRegisterRemovalVersion ¶
func WithRegisterRemovalVersion(version string) RegisterOption
WithRegisterRemovalVersion is used when the Gate is considered StageStable, to inform users that referencing the gate is no longer needed.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func GlobalRegistry ¶ added in v0.70.0
func GlobalRegistry() *Registry
GlobalRegistry returns the global Registry.
func (*Registry) MustRegister ¶ added in v0.71.0
func (r *Registry) MustRegister(id string, stage Stage, opts ...RegisterOption) *Gate
MustRegister like Register but panics if an invalid ID or gate options are provided.
func (*Registry) Register ¶ added in v0.71.0
Register a Gate and return it. The returned Gate can be used to check if is enabled or not.
type Stage ¶
type Stage int8
Stage represents the Gate's lifecycle and what is the expected state of it.
const ( // StageAlpha is used when creating a new feature and the Gate must be explicitly enabled // by the operator. // // The Gate will be disabled by default. StageAlpha Stage = iota // StageBeta is used when the feature flag is well tested and is enabled by default, // but can be disabled by a Gate. // // The Gate will be enabled by default. StageBeta // StageStable is used when feature is permanently enabled and can not be disabled by a Gate. // This value is used to provide feedback to the user that the gate will be removed in the next version. // // The Gate will be enabled by default and will return an error if modified. StageStable )