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 ( // All is the list of all registered feature flags. All = []FeatureFlag{} )
var ExactPaginationTokenMatch = NewFeatureFlag("exact_pagination_token_match", false)
ExactPaginationTokenMatch enables exact matching for provided pagination tokens and returns an error if the match is not found.
var GoFindLicense = NewFeatureFlag("go_find_license", false)
GoFindLicense enables Go implementation of FindLicense
var TreeEntriesViaLsTree = NewFeatureFlag("tree_entries_via_ls_tree", false)
TreeEntriesViaLsTree switches over retrieval of tree entries from using git-cat-file(1) to instead use git-ls-tree(1).
var UserMergeBranchAccessError = NewFeatureFlag("user_merge_branch_access_error", false)
UserMergeBranchAccessError changes error handling such that errors returned by Rails' access checks are returned via error details instead of via the PreReceiveError field.
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 NewFeatureFlag ¶ added in v14.3.0
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 ¶ 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.
func (FeatureFlag) IsEnabled ¶ added in v14.1.0
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 ¶ added in v14.4.0
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.