Documentation ¶
Index ¶
- Constants
- Variables
- func AllFlags(ctx context.Context) []string
- func IncomingCtxWithDisabledFeatureFlag(ctx context.Context, flag FeatureFlag) context.Context
- func IncomingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag) context.Context
- func IncomingCtxWithRubyFeatureFlagValue(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func OutgoingCtxWithDisabledFeatureFlags(ctx context.Context, flags ...FeatureFlag) context.Context
- func OutgoingCtxWithFeatureFlagValue(ctx context.Context, flag FeatureFlag, val string) context.Context
- func OutgoingCtxWithFeatureFlags(ctx context.Context, flags ...FeatureFlag) context.Context
- func OutgoingCtxWithRubyFeatureFlagValue(ctx context.Context, flag FeatureFlag, val string) 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 ( // GoSetConfig enables git2go implementation of SetConfig. GoSetConfig = FeatureFlag{Name: "go_set_config", OnByDefault: false} // FindAllTagsPipeline enables the alternative pipeline implementation for finding // tags via FindAllTags. FindAllTagsPipeline = FeatureFlag{Name: "find_all_tags_pipeline", OnByDefault: false} // QuarantinedResolveCOnflicts enables use of a quarantine object directory for ResolveConflicts. QuarantinedResolveConflicts = FeatureFlag{Name: "quarantined_resolve_conflicts", OnByDefault: false} // GoUserApplyPatch enables the Go implementation of UserApplyPatch GoUserApplyPatch = FeatureFlag{Name: "go_user_apply_patch", OnByDefault: true} // Quarantine enables the use of quarantine directories. Quarantine = FeatureFlag{Name: "quarantine", OnByDefault: false} )
A set of feature flags used in Gitaly and Praefect. In order to support coverage of combined features usage all feature flags should be marked as enabled for the test. NOTE: if you add a new feature flag please add it to the `All` list defined below.
var All = []FeatureFlag{ GoSetConfig, FindAllTagsPipeline, QuarantinedResolveConflicts, GoUserApplyPatch, Quarantine, }
All includes all feature flags.
Functions ¶
func AllFlags ¶
AllFlags returns all feature flags with their value that use the Gitaly metadata prefix. Note: results will not be sorted.
func IncomingCtxWithDisabledFeatureFlag ¶
func IncomingCtxWithDisabledFeatureFlag(ctx context.Context, flag FeatureFlag) context.Context
IncomingCtxWithDisabledFeatureFlag marks feature flag as disabled in the incoming context.
func IncomingCtxWithFeatureFlag ¶
func IncomingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag) context.Context
IncomingCtxWithFeatureFlag is used to enable a feature flag in the incoming context. This is NOT meant for use in clients that transfer the context across process boundaries.
func IncomingCtxWithRubyFeatureFlagValue ¶
func IncomingCtxWithRubyFeatureFlagValue(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
IncomingCtxWithRubyFeatureFlagValue sets the feature flags status in the context.
func OutgoingCtxWithDisabledFeatureFlags ¶
func OutgoingCtxWithDisabledFeatureFlags(ctx context.Context, flags ...FeatureFlag) context.Context
OutgoingCtxWithDisabledFeatureFlags is used to explicitly disable "on by default" feature flags in the outgoing context metadata. The returned context is meant to be used in a client where the outcoming context is transferred to an incoming context.
func OutgoingCtxWithFeatureFlagValue ¶
func OutgoingCtxWithFeatureFlagValue(ctx context.Context, flag FeatureFlag, val string) context.Context
OutgoingCtxWithFeatureFlagValue is used to set feature flags with an explicit value. only "true" or "false" are valid values. Any other value will be ignored.
func OutgoingCtxWithFeatureFlags ¶
func OutgoingCtxWithFeatureFlags(ctx context.Context, flags ...FeatureFlag) context.Context
OutgoingCtxWithFeatureFlags is used to enable feature flags in the outgoing context metadata. The returned context is meant to be used in a client where the outcoming context is transferred to an incoming context.
func OutgoingCtxWithRubyFeatureFlagValue ¶
func OutgoingCtxWithRubyFeatureFlagValue(ctx context.Context, flag FeatureFlag, val string) context.Context
OutgoingCtxWithRubyFeatureFlagValue returns context populated with outgoing metadata that contains ruby feature flags passed in.
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 (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.
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.