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 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
- type FeatureFlag
Constants ¶
This section is empty.
Variables ¶
var CatfileRepoSize = NewFeatureFlag( "catfile_repo_size", "v15.3.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4421", false, )
CatfileRepoSize will enable the rate limiter to reject requests beyond a configured rate.
var DeleteRefsStructuredErrors = NewFeatureFlag( "delete_refs_structured_errors", "v15.3.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4348", false, )
DeleteRefsStructuredErrors turns on metrics for pack objects
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 FetchIntoObjectPoolPruneRefs = NewFeatureFlag( "fetch_into_object_pool_prune_refs", "v15.3.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4394", true, )
FetchIntoObjectPoolPruneRefs enables pruning of references in object pools. This is required in order to fix cases where updating pools doesn't work anymore due to preexisting references conflicting with new references in the pool member.
var FindTagStructuredError = NewFeatureFlag( "find_tag_structured_error", "v15.3.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4398", false, )
FindTagStructuredError enables the use of structured errors for the FindTag RPC in case the tag could not be found.
var GitV2371Gl1 = NewFeatureFlag( "git_v2371gl1", "v15.0.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4194", true, )
GitV2371Gl1 will enable use of Git v2.37.1.gl1.
var GoFindLicense = NewFeatureFlag( "go_find_license", "v14.3.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/3759", false, )
GoFindLicense enables Go implementation of FindLicense
var GoLanguageStats = NewFeatureFlag( "go_language_stats", "v15.2.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4254", false, )
GoLanguageStats flag enables getting CommitLanguages statistics written in Go.
var PraefectGeneratedReplicaPaths = NewFeatureFlag( "praefect_generated_replica_paths", "v15.0.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4218", true, )
PraefectGeneratedReplicaPaths will enable Praefect generated replica paths for new repositories.
var RevlistForRepoSize = NewFeatureFlag( "revlist_for_repo_size", "v14.10.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4317", 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", "v14.10.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4102", false, )
RunCommandsInCGroup allows all commands to be run within a cgroup
var SimplifyFindLocalBranchesResponse = NewFeatureFlag( "simplify_find_local_branches_response", "v15.4.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/1294", false, )
SimplifyFindLocalBranchesResponse enables the simplification of FindLocalBranchesRespnose by adding the generic Branch type in the response
var TransactionalRestoreCustomHooks = NewFeatureFlag( "tx_restore_custom_hooks", "v15.0.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4203", false, )
TransactionalRestoreCustomHooks will use transactional voting in the RestoreCustomHooks RPC
var UseNewRepoSize = NewFeatureFlag( "use_new_repository_size", "v15.4.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4448", false, )
UseNewRepoSize will send the new repository size values in RepositorySize to the client.
var UserCreateBranchStructuredErrors = NewFeatureFlag( "user_create_branch_structured_errors", "v15.4.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4227", false, )
UserCreateBranchStructuredErrors will enable the use of structured errors in the UserCreateTag RPC.
var UserCreateTagStructuredErrors = NewFeatureFlag( "user_create_tag_structured_errors", "v15.3.0", "https://gitlab.com/gitlab-org/gitaly/-/issues/4372", false, )
UserCreateTagStructuredErrors will enable the use of structured errors in the UserCreateTag RPC.
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 ¶ added in v15.2.0
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 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 DefinedFlags ¶ added in v15.2.0
func DefinedFlags() []FeatureFlag
DefinedFlags returns the set of feature flags that have been explicitly defined.
func FromMetadataKey ¶ added in v15.2.0
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 ¶ added in v15.2.0
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_for_repo_size.go
- ff_delete_refs_structured_errors.go
- ff_fetch_into_object_pool_prune_refs.go
- ff_find_tag_structured_error.go
- ff_git_v2371.go
- ff_go_find_license.go
- ff_go_language_stats.go
- ff_praefect_generated_paths.go
- ff_repo_size_revlist.go
- ff_run_cmd_in_cgroup.go
- ff_simplify_find_local_branches_response.go
- ff_transactional_restore_custom_hooks.go
- ff_use_new_calculation_for_repo_size.go
- ff_user_create_branch_structured_errors.go
- ff_user_create_tag_structured_errors.go