Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigResponseEvaluator ¶
type ConfigResponseEvaluator struct {
// contains filtered or unexported fields
}
ConfigResponseEvaluator wraps an Evaluator to work with ConfigResponse objects. It implements the quonfig.configEvaluator interface (unexported, matched by method).
func NewConfigResponseEvaluator ¶
func NewConfigResponseEvaluator(configStore ConfigStoreGetter) *ConfigResponseEvaluator
NewConfigResponseEvaluator creates a new ConfigResponseEvaluator. The configStore is used for segment resolution during evaluation.
func (*ConfigResponseEvaluator) EvaluateConfigResponse ¶
func (e *ConfigResponseEvaluator) EvaluateConfigResponse(cfg *quonfig.ConfigResponse, envID string, ctx *quonfig.ContextSet) *quonfig.Value
EvaluateConfigResponse evaluates a ConfigResponse for the given environment and context. Returns the matched value (or nil if no match).
type ConfigStoreAdapter ¶
type ConfigStoreAdapter struct {
GetFn func(key string) (*quonfig.ConfigResponse, bool)
}
ConfigStoreAdapter adapts a function to the ConfigStoreGetter interface.
func (*ConfigStoreAdapter) GetConfig ¶
func (a *ConfigStoreAdapter) GetConfig(key string) (*FullConfig, bool)
type ConfigStoreGetter ¶
type ConfigStoreGetter interface {
GetConfig(key string) (*FullConfig, bool)
}
ConfigStoreGetter retrieves configs by key.
type ContextValueGetter ¶
type ContextValueGetter = evalcore.ContextValueGetter
ContextValueGetter is re-exported from the shared evalcore package.
type EmptyContext ¶
type EmptyContext = evalcore.EmptyContext
EmptyContext is re-exported from the shared evalcore package.
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator is the main evaluation engine. It delegates to the shared evalcore package.
func NewEvaluator ¶
func NewEvaluator(configStore ConfigStoreGetter) *Evaluator
NewEvaluator creates a new Evaluator.
func NewEvaluatorWithSeed ¶
func NewEvaluatorWithSeed(configStore ConfigStoreGetter, seed int64) *Evaluator
NewEvaluatorWithSeed creates a new Evaluator with a fixed random seed (for testing).
func NewEvaluatorWithTimeSeed ¶
func NewEvaluatorWithTimeSeed(configStore ConfigStoreGetter) *Evaluator
NewEvaluatorWithTimeSeed creates a new Evaluator with a time-based seed.
func (*Evaluator) EvaluateConfig ¶
func (e *Evaluator) EvaluateConfig(cfg *FullConfig, envID string, ctx ContextValueGetter) *EvalMatch
EvaluateConfig evaluates a config for the given environment and context.
type FullConfig ¶
type FullConfig struct {
ID string `json:"id"`
Key string `json:"key"`
Type quonfig.ConfigType `json:"type"`
ValueType quonfig.ValueType `json:"valueType"`
SendToClientSDK bool `json:"sendToClientSdk"`
Default quonfig.RuleSet `json:"default"`
Environments []quonfig.Environment `json:"environments,omitempty"`
}
FullConfig is a config with all environments, matching the raw JSON format. This is used for evaluation where we need to look up configs by environment.
func ConfigResponseToFullConfig ¶
func ConfigResponseToFullConfig(cr *quonfig.ConfigResponse) *FullConfig
ConfigResponseToFullConfig converts a ConfigResponse (with optional single environment) to a FullConfig (with environments array) for use with the evaluator.
func (*FullConfig) FindEnvironment ¶
func (c *FullConfig) FindEnvironment(envID string) *quonfig.Environment
FindEnvironment returns the environment block matching the given environment ID, or nil.