Documentation ¶
Index ¶
- Constants
- Variables
- func AllFlags(ctx context.Context) []string
- func HeaderKey(flag string) 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 IsDisabled(ctx context.Context, flag FeatureFlag) bool
- func IsEnabled(ctx context.Context, flag FeatureFlag) bool
- 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 OutgoingCtxWithRubyFeatureFlags(ctx context.Context, flags ...FeatureFlag) context.Context
- func OutgoingWithRaw(ctx context.Context, flags Raw) context.Context
- type FeatureFlag
- type Raw
Constants ¶
const Delim = ":"
Delim is a delimiter used between a feature flag name and its value.
Variables ¶
var ( // ReferenceTransactions will handle Git reference updates via the transaction service for strong consistency ReferenceTransactions = FeatureFlag{Name: "reference_transactions", OnByDefault: true} // GoUpdateRemoteMirror enables the Go implementation of UpdateRemoteMirror GoUpdateRemoteMirror = FeatureFlag{Name: "go_update_remote_mirror", OnByDefault: false} // FetchInternalRemoteErrors makes FetchInternalRemote return actual errors instead of a boolean FetchInternalRemoteErrors = FeatureFlag{Name: "fetch_internal_remote_errors", OnByDefault: false} // TxConfig enables transactional voting for SetConfig and DeleteConfig RPCs. TxConfig = FeatureFlag{Name: "tx_config", OnByDefault: false} // TxRemote enables transactional voting for AddRemote and DeleteRemote. TxRemote = FeatureFlag{Name: "tx_remote", 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{ ReferenceTransactions, GoUpdateRemoteMirror, FetchInternalRemoteErrors, TxConfig, TxRemote, }
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 IsDisabled ¶
func IsDisabled(ctx context.Context, flag FeatureFlag) bool
IsDisabled is the inverse of IsEnabled
func IsEnabled ¶
func IsEnabled(ctx context.Context, flag FeatureFlag) 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 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.
func OutgoingCtxWithRubyFeatureFlags ¶
func OutgoingCtxWithRubyFeatureFlags(ctx context.Context, flags ...FeatureFlag) context.Context
Types ¶
type FeatureFlag ¶
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.