featureflag

package
v14.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Delim is a delimiter used between a feature flag name and its value.
	Delim = ":"
)

Variables

View Source
var (

	// All is the list of all registered feature flags.
	All = []FeatureFlag{}
)
View Source
var AtomicRemoveRepository = NewFeatureFlag("atomic_remove_repository", false)

AtomicRemoveRepository enables locking semantics for RemoveRepository.

View Source
var ExactPaginationTokenMatch = NewFeatureFlag("exact_pagination_token_match", false)

ExactPaginationTokenMatch enables exact matching for provided pagination tokens and returns an error if the match is not found.

View Source
var GoFindLicense = NewFeatureFlag("go_find_license", false)

GoFindLicense enables Go implementation of FindLicense

View Source
var RunCommandsInCGroup = NewFeatureFlag("run_cmds_in_cgroup", true)

RunCommandsInCGroup allows all commands to be run within a cgroup

View Source
var TxApplyGitattributesTwoPhaseRemoval = NewFeatureFlag("tx_apply_gitattributes_two_phase_removal", false)

TxApplyGitattributesTwoPhaseRemoval enables two-phase voting on the removal of the gitattributes file.

View Source
var TxAtomicRepositoryCreation = NewFeatureFlag("tx_atomic_repository_creation", true)

TxAtomicRepositoryCreation will switch CreateRepository, CreateRepositoryFromBundle, CreateRepositoryFromSnapshot and CreateRepositoryFromURL to have proper transactional guarantees. This changes behaviour such the target repository must not exist previous to the call, creation and seeding of the repository is done in a temporary staging area and then moved into place only if no other RPC call created it concurrently.

View Source
var TxTwoPhaseDeleteRefs = NewFeatureFlag("tx_two_phase_delete_refs", false)

TxTwoPhaseDeleteRefs enables two-phase voting for the DeleteRefs RPC.

View Source
var UserMergeBranchAccessError = NewFeatureFlag("user_merge_branch_access_error", false)

UserMergeBranchAccessError changes error handling such that errors returned by Rails' access checks are returned via error details instead of via the PreReceiveError field.

Functions

func AllFlags

func AllFlags(ctx context.Context) []string

AllFlags returns all feature flags with their value that use the Gitaly metadata prefix. Note: results will not be sorted.

func ContextWithExplicitFeatureFlags added in v14.6.0

func ContextWithExplicitFeatureFlags(ctx context.Context) context.Context

ContextWithExplicitFeatureFlags marks the context such that all feature flags which are checked must have been explicitly set in that context. If a feature flag wasn't set to an explicit value, then checking this feature flag will panic. This is not for use in production systems, but is intended for tests to verify that we test each feature flag properly.

func ContextWithFeatureFlags added in v14.6.0

func ContextWithFeatureFlags(ctx context.Context, featureFlags ...FeatureFlag) context.Context

ContextWithFeatureFlags returns a new context with the given feature flags enabled. This is not for use in production systems, but is intended to be used in tests.

func IncomingCtxWithFeatureFlag

func IncomingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context

IncomingCtxWithFeatureFlag sets the feature flag for an incoming context. This is NOT meant for use in clients that transfer the context across process boundaries.

func IncomingCtxWithRubyFeatureFlag added in v14.6.0

func IncomingCtxWithRubyFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context

IncomingCtxWithRubyFeatureFlag sets the Ruby feature flag for an incoming context. This is NOT meant for use in clients that transfer the context across process boundaries.

func OutgoingCtxWithFeatureFlag added in v14.6.0

func OutgoingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context

OutgoingCtxWithFeatureFlag sets the feature flag for an outgoing context.

func OutgoingCtxWithRubyFeatureFlag added in v14.6.0

func OutgoingCtxWithRubyFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context

OutgoingCtxWithRubyFeatureFlag sets the Ruby feature flag for an outgoing context.

func OutgoingWithRaw

func OutgoingWithRaw(ctx context.Context, flags Raw) context.Context

OutgoingWithRaw returns a new context with raw flags appended into the outgoing metadata.

Types

type FeatureFlag

type FeatureFlag struct {
	// Name is the name of the feature flag.
	Name string `json:"name"`
	// OnByDefault is the default value if the feature flag is not explicitly set in
	// the incoming context.
	OnByDefault bool `json:"on_by_default"`
}

FeatureFlag gates the implementation of new or changed functionality.

func NewFeatureFlag added in v14.3.0

func NewFeatureFlag(name string, onByDefault bool) FeatureFlag

NewFeatureFlag creates a new feature flag and adds it to the array of all existing feature flags.

func (FeatureFlag) IsDisabled added in v14.1.0

func (ff FeatureFlag) IsDisabled(ctx context.Context) bool

IsDisabled determines whether the feature flag is disabled in the incoming context.

func (FeatureFlag) IsEnabled added in v14.1.0

func (ff FeatureFlag) IsEnabled(ctx context.Context) bool

IsEnabled checks if the feature flag is enabled for the passed context. Only returns true if the metadata for the feature flag is set to "true"

func (FeatureFlag) MetadataKey added in v14.4.0

func (ff FeatureFlag) MetadataKey() string

MetadataKey returns the key of the feature flag as it is present in the metadata map.

type Raw

type Raw map[string]string

Raw contains feature flags and their values in their raw form with header prefix in place and values unparsed.

func RawFromContext

func RawFromContext(ctx context.Context) Raw

RawFromContext returns a map that contains all feature flags with their values. The feature flags are in their raw format with the header prefix in place. If multiple values are set a flag, the first occurrence is used.

This is mostly intended for propagating the feature flags by other means than the metadata, for example into the hooks through the environment.

Jump to

Keyboard shortcuts

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