FeatureToggles: Add context and and an explicit global check (#78081)

This commit is contained in:
Ryan McKinley
2023-11-14 12:50:27 -08:00
committed by GitHub
parent c887ef2c9a
commit f69fd3726b
94 changed files with 228 additions and 208 deletions

View File

@@ -2,11 +2,21 @@ package featuremgmt
import (
"bytes"
"context"
"encoding/json"
)
type FeatureToggles interface {
IsEnabled(flag string) bool
// Check if a feature is enabled for a given context.
// The settings may be per user, tenant, or globally set in the cloud
IsEnabled(ctx context.Context, flag string) bool
// Check if a flag is configured globally. For now, this is the same
// as the function above, however it will move to only checking flags that
// are configured by the operator and shared across all tenants.
// Use of global feature flags should be limited and careful as they require
// a full server restart for a change to take place.
IsEnabledGlobally(flag string) bool
}
// FeatureFlagStage indicates the quality level