Documentation ¶
Index ¶
- Variables
- func ContextWithExplicitFeatureFlags(ctx context.Context) context.Context
- func ContextWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func FromContext(ctx context.Context) map[FeatureFlag]bool
- func IncomingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func OutgoingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- type FeatureFlag
Constants ¶
This section is empty.
Variables ¶
var CatfileBatchCommand = NewFeatureFlag( "catfile_batch_command", "v16.2.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4573", false, )
CatfileBatchCommand enables the `--batch-command` mode for git-cat-file(1).
var CherryPickPureGit = NewFeatureFlag( "cherry_pick_pure_git", "v16.2.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/5421", false, )
CherryPickPureGit will enable the UserCherryPick RPC to use git-merge-tree instead of git2go
var ( // EnableAllFeatureFlagsEnvVar will cause Gitaly to treat all feature flags as // enabled in case its value is set to `true`. Only used for testing purposes. EnableAllFeatureFlagsEnvVar = "GITALY_TESTING_ENABLE_ALL_FEATURE_FLAGS" )
var FindChangedPathsBatchedValidation = NewFeatureFlag( "find_changed_paths_batched_validation", "v16.2.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/5410", false, )
FindChangedPathsBatchedValidation enables the use of batched validation in the FindChangedPaths RPC
var GPGSigning = NewFeatureFlag( "gpg_signing", "v16.2.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/5361", false, )
GPGSigning enables the use of Git v2.41.
var MailmapOptions = NewFeatureFlag( "mailmap_options", "v16.2.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/5394", true, )
MailmapOptions enables the use of mailmap feature in GitLab
var MergeToRefWithGit = NewFeatureFlag( "merge_to_ref_with_git", "v16.2.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/5401", false, )
MergeToRefWithGit will enable the UserMergeToRef RPC to use git-merge-tree instead of git2go
var ResolveConflictsViaGit = NewFeatureFlag( "resolve_conflicts_via_git", "v16.2.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/5395", false, )
ResolveConflictsViaGit enables the usage of git-merge-tree(1) for the ResolveConflicts RPC.
var RunCommandsInCGroup = NewFeatureFlag( "run_cmds_in_cgroup", "v14.10.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4102", true, )
RunCommandsInCGroup allows all commands to be run within a cgroup
var SquashInGit = NewFeatureFlag( "squash_in_git", "v16.2.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/5424", false, )
SquashInGit enables the pure git implementation of UserSquash
var SynchronizeHookExecutions = NewFeatureFlag( "synchronize_hook_executions", "v16.1.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/5359", true, )
SynchronizeHookExecutions synchronizes execution of Git hooks across all Gitaly nodes taking part in a transaction in Gitaly Cluster. This is done to avoid lock contention around the `packed-refs` file.
Functions ¶
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 FromContext ¶
func FromContext(ctx context.Context) map[FeatureFlag]bool
FromContext returns the set of all feature flags defined in the context. This returns both feature flags that are currently defined by Gitaly, but may also return some that aren't defined by us in case they match the feature flag prefix but don't have a definition. This function also returns the state of the feature flag *as defined in the context*. This value may be overridden.
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 OutgoingCtxWithFeatureFlag ¶
func OutgoingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
OutgoingCtxWithFeatureFlag sets the 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 DefinedFlags ¶
func DefinedFlags() []FeatureFlag
DefinedFlags returns the set of feature flags that have been explicitly defined.
func FromMetadataKey ¶
func FromMetadataKey(metadataKey string) (FeatureFlag, error)
FromMetadataKey parses the given gRPC metadata key into a Gitaly feature flag and performs the necessary conversions. Returns an error in case the metadata does not refer to a feature flag.
This function tries to look up the default value via our set of flag definitions. In case the flag definition is unknown to Gitaly it assumes a default value of `false`.
func NewFeatureFlag ¶
func NewFeatureFlag(name, version, rolloutIssueURL string, onByDefault bool) FeatureFlag
NewFeatureFlag creates a new feature flag and adds it to the array of all existing feature flags. The name must be of the format `some_feature_flag`. Accepts a version and rollout issue URL as input that are not used for anything but only for the sake of linking to the feature flag rollout issue in the Gitaly project.
func (FeatureFlag) FormatWithValue ¶
func (ff FeatureFlag) FormatWithValue(enabled bool) string
FormatWithValue converts the feature flag into a string with the given state. Note that this function uses the feature flag name and not the raw metadata key as used in gRPC metadata.
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.
Source Files ¶
- context.go
- featureflag.go
- ff_catfile_batch_command.go
- ff_cherry_pick_pure_git.go
- ff_find_changed_paths_batched_validation.go
- ff_gitaly_gpg_signing.go
- ff_mailmap_options.go
- ff_merge_to_ref_git.go
- ff_resolve_conflicts_via_git.go
- ff_run_cmd_in_cgroup.go
- ff_sqush_in_git.go
- ff_synchronize_hook_executions.go