Documentation ¶
Index ¶
- Constants
- Variables
- func AllFlags(ctx context.Context) []string
- func ContextWithExplicitFeatureFlags(ctx context.Context) context.Context
- func ContextWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func IncomingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func IncomingCtxWithRubyFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func OutgoingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func OutgoingCtxWithRubyFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func OutgoingWithRaw(ctx context.Context, flags Raw) context.Context
- type FeatureFlag
- type Raw
Constants ¶
const (
// Delim is a delimiter used between a feature flag name and its value.
Delim = ":"
)
Variables ¶
var ( // All is the list of all registered feature flags. All = []FeatureFlag{} )
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.
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.
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.
var GitV2361Gl1 = NewFeatureFlag("git_v2361gl1", false)
GitV2361Gl1 will enable use of Git v2.36.1.gl1.
var GoFindLicense = NewFeatureFlag("go_find_license", false)
GoFindLicense enables Go implementation of FindLicense
var PraefectGeneratedReplicaPaths = NewFeatureFlag("praefect_generated_replica_paths", false)
PraefectGeneratedReplicaPaths will enable Praefect generated replica paths for new repositories.
var RateLimit = NewFeatureFlag("rate_limit", false)
RateLimit will enable the rate limiter to reject requests beyond a configured rate.
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.
var RunCommandsInCGroup = NewFeatureFlag("run_cmds_in_cgroup", false)
RunCommandsInCGroup allows all commands to be run within a cgroup
var TransactionalRestoreCustomHooks = NewFeatureFlag("tx_restore_custom_hooks", false)
TransactionalRestoreCustomHooks will use transactional voting in the RestoreCustomHooks RPC
var UserDeleteBranchStructuredErrors = NewFeatureFlag("user_delete_branch_structured_errors", false)
UserDeleteBranchStructuredErrors enables the use of structured errors for the UserDeleteBranch RPC.
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 ¶
AllFlags returns all feature flags with their value that use the Gitaly metadata prefix. Note: results will not be sorted.
func ContextWithExplicitFeatureFlags ¶
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 ¶
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.
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 ¶
Raw contains feature flags and their values in their raw form with header prefix in place and values unparsed.
func RawFromContext ¶
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.
Source Files ¶
- context.go
- featureflag.go
- ff_exact_pagination_token_match.go
- ff_get_archive_lfs_filter_process.go
- ff_git_v2361.go
- ff_go_find_license.go
- ff_praefect_generated_paths.go
- ff_queue_max.go
- ff_rate_limiter.go
- ff_repo_size_revlist.go
- ff_run_cmd_in_cgroup.go
- ff_transactional_restore_custom_hooks.go
- ff_user_delete_branch_structured_errors.go
- ff_user_rebase_confirmable_improved_error_handling.go