diff options
Diffstat (limited to 'internal/metadata/featureflag/feature_flags.go')
-rw-r--r-- | internal/metadata/featureflag/feature_flags.go | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/internal/metadata/featureflag/feature_flags.go b/internal/metadata/featureflag/feature_flags.go index 19f703759..ee8c60682 100644 --- a/internal/metadata/featureflag/feature_flags.go +++ b/internal/metadata/featureflag/feature_flags.go @@ -1,31 +1,55 @@ package featureflag -type FeatureFlag struct { - Name string `json:"name"` +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 = FeatureFlag{Name: "go_update_hook", OnByDefault: true} + GoUpdateHook = GoFeatureFlag{Name: "go_update_hook", OnByDefault: true} // RemoteBranchesLsRemote will use `ls-remote` for remote branches - RemoteBranchesLsRemote = FeatureFlag{Name: "ruby_remote_branches_ls_remote", OnByDefault: true} + RemoteBranchesLsRemote = GoFeatureFlag{Name: "ruby_remote_branches_ls_remote", OnByDefault: true} // GoFetchSourceBranch enables a go implementation of FetchSourceBranch - GoFetchSourceBranch = FeatureFlag{Name: "go_fetch_source_branch", OnByDefault: false} + GoFetchSourceBranch = GoFeatureFlag{Name: "go_fetch_source_branch", OnByDefault: false} // DistributedReads allows praefect to redirect accessor operations to up-to-date secondaries - DistributedReads = FeatureFlag{Name: "distributed_reads", OnByDefault: false} + DistributedReads = GoFeatureFlag{Name: "distributed_reads", OnByDefault: false} // GoPreReceiveHook will bypass the ruby pre-receive hook and use the go implementation - GoPreReceiveHook = FeatureFlag{Name: "go_prereceive_hook", OnByDefault: true} + GoPreReceiveHook = GoFeatureFlag{Name: "go_prereceive_hook", OnByDefault: true} // GoPostReceiveHook will bypass the ruby post-receive hook and use the go implementation - GoPostReceiveHook = FeatureFlag{Name: "go_postreceive_hook", OnByDefault: false} + GoPostReceiveHook = GoFeatureFlag{Name: "go_postreceive_hook", OnByDefault: false} // ReferenceTransactions will handle Git reference updates via the transaction service for strong consistency - ReferenceTransactions = FeatureFlag{Name: "reference_transactions", OnByDefault: false} + ReferenceTransactions = GoFeatureFlag{Name: "reference_transactions", OnByDefault: false} // ReferenceTransactionsOperationService will enable reference transactions for the OperationService - ReferenceTransactionsOperationService = FeatureFlag{Name: "reference_transactions_operation_service", OnByDefault: true} + ReferenceTransactionsOperationService = GoFeatureFlag{Name: "reference_transactions_operation_service", OnByDefault: true} // ReferenceTransactionsSmartHTTPService will enable reference transactions for the SmartHTTPService - ReferenceTransactionsSmartHTTPService = FeatureFlag{Name: "reference_transactions_smarthttp_service", OnByDefault: true} + ReferenceTransactionsSmartHTTPService = GoFeatureFlag{Name: "reference_transactions_smarthttp_service", OnByDefault: true} // ReferenceTransactionsSSHService will enable reference transactions for the SSHService - ReferenceTransactionsSSHService = FeatureFlag{Name: "reference_transactions_ssh_service", OnByDefault: true} + ReferenceTransactionsSSHService = GoFeatureFlag{Name: "reference_transactions_ssh_service", OnByDefault: true} ) const ( |