Welcome to mirror list, hosted at ThFree Co, Russian Federation.

feature_flags.go « featureflag « metadata « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ee8c60682ad66e3d4f1238cb17690713c0318be6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package featureflag

type FeatureFlag interface {
	GetName() string
	IsOnByDefault() bool
}

type RubyFeatureFlag struct {
	GoFeatureFlag
}

type GoFeatureFlag struct {
	Name        string `json:"Name"`
	OnByDefault bool   `json:"on_by_default"`
}

func (g GoFeatureFlag) GetName() string {
	return g.Name
}

func (g GoFeatureFlag) IsOnByDefault() bool {
	return g.OnByDefault
}

func NewGoFeatureFlag(Name string, OnByDefault bool) *GoFeatureFlag {
	return &GoFeatureFlag{
		Name:        Name,
		OnByDefault: OnByDefault,
	}
}

var (
	// GoUpdateHook will bypass the ruby update hook and use the go implementation of custom hooks
	GoUpdateHook = GoFeatureFlag{Name: "go_update_hook", OnByDefault: true}
	// RemoteBranchesLsRemote will use `ls-remote` for remote branches
	RemoteBranchesLsRemote = GoFeatureFlag{Name: "ruby_remote_branches_ls_remote", OnByDefault: true}
	// GoFetchSourceBranch enables a go implementation of FetchSourceBranch
	GoFetchSourceBranch = GoFeatureFlag{Name: "go_fetch_source_branch", OnByDefault: false}
	// DistributedReads allows praefect to redirect accessor operations to up-to-date secondaries
	DistributedReads = GoFeatureFlag{Name: "distributed_reads", OnByDefault: false}
	// GoPreReceiveHook will bypass the ruby pre-receive hook and use the go implementation
	GoPreReceiveHook = GoFeatureFlag{Name: "go_prereceive_hook", OnByDefault: true}
	// GoPostReceiveHook will bypass the ruby post-receive hook and use the go implementation
	GoPostReceiveHook = GoFeatureFlag{Name: "go_postreceive_hook", OnByDefault: false}
	// ReferenceTransactions will handle Git reference updates via the transaction service for strong consistency
	ReferenceTransactions = GoFeatureFlag{Name: "reference_transactions", OnByDefault: false}
	// ReferenceTransactionsOperationService will enable reference transactions for the OperationService
	ReferenceTransactionsOperationService = GoFeatureFlag{Name: "reference_transactions_operation_service", OnByDefault: true}
	// ReferenceTransactionsSmartHTTPService will enable reference transactions for the SmartHTTPService
	ReferenceTransactionsSmartHTTPService = GoFeatureFlag{Name: "reference_transactions_smarthttp_service", OnByDefault: true}
	// ReferenceTransactionsSSHService will enable reference transactions for the SSHService
	ReferenceTransactionsSSHService = GoFeatureFlag{Name: "reference_transactions_ssh_service", OnByDefault: true}
)

const (
	GoUpdateHookEnvVar      = "GITALY_GO_UPDATE"
	GoPreReceiveHookEnvVar  = "GITALY_GO_PRERECEIVE"
	GoPostReceiveHookEnvVar = "GITALY_GO_POSTRECEIVE"
)