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 ( // 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: true} // TxRemote enables transactional voting for AddRemote and DeleteRemote. TxRemote = FeatureFlag{Name: "tx_remote", OnByDefault: true} // UserMergeToRefSkipPrecursorRefUpdate causes UserMergeToRef to not update the // target reference in case computing the merge fails. UserMergeToRefSkipPrecursorRefUpdate = FeatureFlag{Name: "user_merge_to_ref_skip_precursor_ref_update", OnByDefault: true} // LFSPointersPipeline enables the alternative pipeline implementation of LFS-pointer // related RPCs. LFSPointersPipeline = FeatureFlag{Name: "lfs_pointers_pipeline", OnByDefault: false} // CreateRepositoryFromBundleAtomicFetch will add the `--atomic` flag to git-fetch(1) in // order to reduce the number of transactional votes. CreateRepositoryFromBundleAtomicFetch = FeatureFlag{Name: "create_repository_from_bundle_atomic_fetch", OnByDefault: false} // ReplicateRepositoryDirectFetch will cause the ReplicateRepository RPC to perform fetches // via a direct call instead of doing an RPC call to its own server. This fixes calls of // `ReplicateRepository()` in case it's invoked via Praefect with transactions enabled. ReplicateRepositoryDirectFetch = FeatureFlag{Name: "replicate_repository_direct_fetch", OnByDefault: false} // TxRemoveRepository enables transactionsal voting for the RemoveRepository RPC. TxRemoveRepository = FeatureFlag{Name: "tx_remove_repository", 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{ GoUpdateRemoteMirror, FetchInternalRemoteErrors, TxConfig, TxRemote, UserMergeToRefSkipPrecursorRefUpdate, LFSPointersPipeline, CreateRepositoryFromBundleAtomicFetch, ReplicateRepositoryDirectFetch, TxRemoveRepository, }
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.