featureflag

package
v15.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 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 ConcurrencyQueueEnforceMax = NewFeatureFlag("concurrency_queue_enforce_max", false)

ConcurrencyQueueEnforceMax enforces a maximum number of items that are waiting in a concurrency queue. when this flag is turned on, subsequent requests that come in will be rejected with an error.

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

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

View Source
var GetArchiveLfsFilterProcess = NewFeatureFlag("get_archive_lfs_filter_process", false)

GetArchiveLfsFilterProcess enables the use of a long-running filter process to smudge LFS pointers to their contents.

View Source
var GitV2361Gl1 = NewFeatureFlag("git_v2361gl1", false)

GitV2361Gl1 will enable use of Git v2.36.1.gl1.

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

GoFindLicense enables Go implementation of FindLicense

View Source
var PraefectGeneratedReplicaPaths = NewFeatureFlag("praefect_generated_replica_paths", false)

PraefectGeneratedReplicaPaths will enable Praefect generated replica paths for new repositories.

View Source
var RateLimit = NewFeatureFlag("rate_limit", false)

RateLimit will enable the rate limiter to reject requests beyond a configured rate.

View Source
var RevlistForRepoSize = NewFeatureFlag("revlist_for_repo_size", false)

RevlistForRepoSize enables the RepositorySize RPC to use git rev-list to calculate the disk usage of the repository.

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

RunCommandsInCGroup allows all commands to be run within a cgroup

View Source
var TransactionalRestoreCustomHooks = NewFeatureFlag("tx_restore_custom_hooks", false)

TransactionalRestoreCustomHooks will use transactional voting in the RestoreCustomHooks RPC

View Source
var UserDeleteBranchStructuredErrors = NewFeatureFlag("user_delete_branch_structured_errors", false)

UserDeleteBranchStructuredErrors enables the use of structured errors for the UserDeleteBranch RPC.

View Source
var UserRebaseConfirmableImprovedErrorHandling = NewFeatureFlag("user_rebase_confirmable_improved_error_handling", false)

UserRebaseConfirmableImprovedErrorHandling enables proper error handling in the UserRebaseConfirmable RPC. When this flag is disabled many error cases were returning successfully with an error message embedded in the response. With this flag enabled, this is converted to return real gRPC errors with structured errors.

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

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 ContextWithFeatureFlag

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

ContextWithFeatureFlag sets the feature flag in both the incoming and outgoing context.

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

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

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

OutgoingCtxWithFeatureFlag sets the feature flag for an outgoing context.

func OutgoingCtxWithRubyFeatureFlag

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

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

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

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

func (FeatureFlag) IsEnabled

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

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