Documentation
¶
Overview ¶
Package flags implements Console's feature-flag evaluation engine. It wraps a store.FlagStore for persistence and resolves a flag to an Evaluation for a given subject deterministically: the same (flag, subject) pair always yields the same result, so a rollout is stable across calls and processes.
Index ¶
- type Engine
- func (e *Engine) Create(ctx context.Context, f core.Flag) error
- func (e *Engine) Delete(ctx context.Context, key string) error
- func (e *Engine) Evaluate(ctx context.Context, key string, subj core.Subject) (core.Evaluation, error)
- func (e *Engine) Get(ctx context.Context, key string) (core.Flag, error)
- func (e *Engine) List(ctx context.Context) ([]core.Flag, error)
- func (e *Engine) SetEmitter(fn func(core.Event))
- func (e *Engine) Update(ctx context.Context, f core.Flag) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine evaluates feature flags and provides CRUD passthrough to its store.
func (*Engine) Evaluate ¶
func (e *Engine) Evaluate(ctx context.Context, key string, subj core.Subject) (core.Evaluation, error)
Evaluate resolves key for subj. The result is deterministic per (flag, subject): bucketing is derived from a stable hash, never from randomness, so repeated calls are identical.
The pipeline is: load → enabled gate → scope gate → rollout gate → variant selection. The first gate that fails returns a disabled "off" Evaluation with a Reason naming the gate.
func (*Engine) SetEmitter ¶
SetEmitter installs an event sink (e.g. a notify.Dispatcher's Emit). Passing nil disables emission.