Versions in this module Expand all Collapse all v0 v0.1.0 Mar 16, 2017 Changes in this version + const StorageEnvironmentBad + const StorageEnvironmentDev + const StorageEnvironmentProd + var ErrBadStorageEnvironment = errors.New("bad storage environment") + var ErrGlobalSaltAlreadySet = errors.New("global salt already set") + var ErrSegmentNotInExperiment = errors.New("Segment is not assigned to an experiment") + var ErrSegmentUnavailable = errors.New("segment unavailable") + func HashExperience(namespace, experiment, param, userID string) (uint64, error) + func InSegment(namespace, userID string, s segments) bool + func SetGlobalSalt(s string) error + type Config struct + ErrChan chan error + func NewChoices(ctx context.Context, opts ...ConfigOpt) (*Config, error) + func (c *Config) IsHealthy() error + func (ec *Config) Namespaces(userID string, selector labels.Selector) ([]ExperimentResponse, error) + type ConfigOpt func(*Config) error + func WithGlobalSalt(s string) ConfigOpt + func WithMaxUpdateFailTime(dur time.Duration) ConfigOpt + func WithStorageConfig(addr string, env int, updateInterval time.Duration) ConfigOpt + func WithUpdateInterval(dur time.Duration) ConfigOpt + type ErrUpdateStorage struct + func (e ErrUpdateStorage) Error() string + type Experiment struct + Labels labels.Set + Name string + Params []Param + Segments segments + func FromExperiment(s *storage.Experiment) Experiment + func NewExperiment(name string) *Experiment + func (e *Experiment) MarshalJSON() ([]byte, error) + func (e *Experiment) SampleSegments(ns *Namespace, num int) *Experiment + func (e *Experiment) SetSegments(seg segments) *Experiment + func (e *Experiment) ToExperiment() *storage.Experiment + type ExperimentResponse struct + Name string + Namespace string + Params []ParamValue + type Namespace struct + Experiments []Experiment + Name string + Segments segments + func FromNamespace(s *storage.Namespace) (Namespace, error) + func NewNamespace(name string) *Namespace + func (n *Namespace) MarshalJSON() ([]byte, error) + func (n *Namespace) ToNamespace() *storage.Namespace + type Param struct + Name string + Value Value + func FromParam(s *storage.Param) Param + func (p *Param) MarshalJSON() ([]byte, error) + func (p *Param) ToParam() *storage.Param + type ParamValue struct + Name string + Value string + type Uniform struct + Choices []string + func (u *Uniform) MarshalJSON() ([]byte, error) + func (u *Uniform) Value(i uint64) (string, error) + type Value interface + Value func(i uint64) (string, error) + type ValueType int + const ValueTypeBad + const ValueTypeUniform + const ValueTypeWeighted + type Weighted struct + Choices []string + Weights []float64 + func (w *Weighted) MarshalJSON() ([]byte, error) + func (w *Weighted) Value(i uint64) (string, error)