Documentation
¶
Overview ¶
Package decision //
Package decision //
Package decision //
Package decision //
Package decision //
Package decision //
Package decision //
Package decision //
Package decision //
Package decision //
Package decision //
Index ¶
- type CESOptionFunc
- type CSOptionFunc
- type CompositeExperimentService
- type CompositeFeatureService
- type CompositeService
- func (s CompositeService) GetExperimentDecision(experimentDecisionContext ExperimentDecisionContext, ...) (experimentDecision ExperimentDecision, err error)
- func (s CompositeService) GetFeatureDecision(featureDecisionContext FeatureDecisionContext, ...) (FeatureDecision, error)
- func (s CompositeService) OnDecision(callback func(notification.DecisionNotification)) (int, error)
- func (s CompositeService) RemoveOnDecision(id int) error
- type Decision
- type ExperimentBucketerService
- type ExperimentDecision
- type ExperimentDecisionContext
- type ExperimentOverrideKey
- type ExperimentOverrideService
- type ExperimentOverrideStore
- type ExperimentService
- type ExperimentWhitelistService
- type FeatureDecision
- type FeatureDecisionContext
- type FeatureExperimentService
- type FeatureService
- type MapExperimentOverridesStore
- type PersistingExperimentService
- type RolloutService
- type Service
- type Source
- type UserDecisionKey
- type UserProfile
- type UserProfileService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CESOptionFunc ¶
type CESOptionFunc func(*CompositeExperimentService)
CESOptionFunc is used to assign optional configuration options
func WithOverrideStore ¶
func WithOverrideStore(overrideStore ExperimentOverrideStore) CESOptionFunc
WithOverrideStore adds an experiment override store
func WithUserProfileService ¶
func WithUserProfileService(userProfileService UserProfileService) CESOptionFunc
WithUserProfileService adds a user profile service
type CSOptionFunc ¶
type CSOptionFunc func(*CompositeService)
CSOptionFunc is used to pass custom config options into the CompositeService.
func WithCompositeExperimentService ¶
func WithCompositeExperimentService(compositeExperimentService ExperimentService) CSOptionFunc
WithCompositeExperimentService sets the composite experiment service on the CompositeService
type CompositeExperimentService ¶
type CompositeExperimentService struct {
// contains filtered or unexported fields
}
CompositeExperimentService bridges together the various experiment decision services that ship by default with the SDK
func NewCompositeExperimentService ¶
func NewCompositeExperimentService(options ...CESOptionFunc) *CompositeExperimentService
NewCompositeExperimentService creates a new instance of the CompositeExperimentService
func (CompositeExperimentService) GetDecision ¶
func (s CompositeExperimentService) GetDecision(decisionContext ExperimentDecisionContext, userContext entities.UserContext) (decision ExperimentDecision, err error)
GetDecision returns a decision for the given experiment and user context
type CompositeFeatureService ¶
type CompositeFeatureService struct {
// contains filtered or unexported fields
}
CompositeFeatureService is the default out-of-the-box feature decision service
func NewCompositeFeatureService ¶
func NewCompositeFeatureService(compositeExperimentService ExperimentService) *CompositeFeatureService
NewCompositeFeatureService returns a new instance of the CompositeFeatureService
func (CompositeFeatureService) GetDecision ¶
func (f CompositeFeatureService) GetDecision(decisionContext FeatureDecisionContext, userContext entities.UserContext) (FeatureDecision, error)
GetDecision returns a decision for the given feature and user context
type CompositeService ¶
type CompositeService struct {
// contains filtered or unexported fields
}
CompositeService is the entry-point into the decision service. It provides out of the box decision making for Features and Experiments.
func NewCompositeService ¶
func NewCompositeService(sdkKey string, options ...CSOptionFunc) *CompositeService
NewCompositeService returns a new instance of the CompositeService with the defaults
func (CompositeService) GetExperimentDecision ¶
func (s CompositeService) GetExperimentDecision(experimentDecisionContext ExperimentDecisionContext, userContext entities.UserContext) (experimentDecision ExperimentDecision, err error)
GetExperimentDecision returns a decision for the given experiment key
func (CompositeService) GetFeatureDecision ¶
func (s CompositeService) GetFeatureDecision(featureDecisionContext FeatureDecisionContext, userContext entities.UserContext) (FeatureDecision, error)
GetFeatureDecision returns a decision for the given feature key
func (CompositeService) OnDecision ¶
func (s CompositeService) OnDecision(callback func(notification.DecisionNotification)) (int, error)
OnDecision registers a handler for Decision notifications
func (CompositeService) RemoveOnDecision ¶
func (s CompositeService) RemoveOnDecision(id int) error
RemoveOnDecision removes handler for Decision notification with given id
type ExperimentBucketerService ¶
type ExperimentBucketerService struct {
// contains filtered or unexported fields
}
ExperimentBucketerService makes a decision using the experiment bucketer
func NewExperimentBucketerService ¶
func NewExperimentBucketerService() *ExperimentBucketerService
NewExperimentBucketerService returns a new instance of the ExperimentBucketerService
func (ExperimentBucketerService) GetDecision ¶
func (s ExperimentBucketerService) GetDecision(decisionContext ExperimentDecisionContext, userContext entities.UserContext) (ExperimentDecision, error)
GetDecision returns the decision with the variation the user is bucketed into
type ExperimentDecision ¶
ExperimentDecision contains the decision information about an experiment
type ExperimentDecisionContext ¶
type ExperimentDecisionContext struct { Experiment *entities.Experiment ProjectConfig config.ProjectConfig }
ExperimentDecisionContext contains the information needed to be able to make a decision for a given experiment
type ExperimentOverrideKey ¶
type ExperimentOverrideKey struct {
ExperimentKey, UserID string
}
ExperimentOverrideKey represents the user ID and experiment associated with an override variation
type ExperimentOverrideService ¶
type ExperimentOverrideService struct {
Overrides ExperimentOverrideStore
}
ExperimentOverrideService makes a decision using an ExperimentOverridesStore Implements the ExperimentService interface
func NewExperimentOverrideService ¶
func NewExperimentOverrideService(overrides ExperimentOverrideStore) *ExperimentOverrideService
NewExperimentOverrideService returns a pointer to an initialized ExperimentOverrideService
func (ExperimentOverrideService) GetDecision ¶
func (s ExperimentOverrideService) GetDecision(decisionContext ExperimentDecisionContext, userContext entities.UserContext) (ExperimentDecision, error)
GetDecision returns a decision with a variation when the store returns a variation assignment for the given user and experiment
type ExperimentOverrideStore ¶
type ExperimentOverrideStore interface { // Returns a variation associated with overrideKey GetVariation(overrideKey ExperimentOverrideKey) (string, bool) }
ExperimentOverrideStore provides read access to overrides
type ExperimentService ¶
type ExperimentService interface {
GetDecision(decisionContext ExperimentDecisionContext, userContext entities.UserContext) (ExperimentDecision, error)
}
ExperimentService can make a decision about an experiment
type ExperimentWhitelistService ¶
type ExperimentWhitelistService struct{}
ExperimentWhitelistService makes a decision using an experiment's whitelist (a map of user id to variation keys) Implements the ExperimentService interface
func NewExperimentWhitelistService ¶
func NewExperimentWhitelistService() *ExperimentWhitelistService
NewExperimentWhitelistService returns a new instance of ExperimentWhitelistService
func (ExperimentWhitelistService) GetDecision ¶
func (s ExperimentWhitelistService) GetDecision(decisionContext ExperimentDecisionContext, userContext entities.UserContext) (ExperimentDecision, error)
GetDecision returns a decision with a variation when a variation assignment is found in the experiment whitelist for the given user and experiment
type FeatureDecision ¶
type FeatureDecision struct { Decision Source Source Experiment entities.Experiment Variation *entities.Variation }
FeatureDecision contains the decision information about a feature
type FeatureDecisionContext ¶
type FeatureDecisionContext struct { Feature *entities.Feature ProjectConfig config.ProjectConfig Variable entities.Variable }
FeatureDecisionContext contains the information needed to be able to make a decision for a given feature
type FeatureExperimentService ¶
type FeatureExperimentService struct {
// contains filtered or unexported fields
}
FeatureExperimentService helps evaluate feature test associated with the feature
func NewFeatureExperimentService ¶
func NewFeatureExperimentService(compositeExperimentService ExperimentService) *FeatureExperimentService
NewFeatureExperimentService returns a new instance of the FeatureExperimentService
func (FeatureExperimentService) GetDecision ¶
func (f FeatureExperimentService) GetDecision(decisionContext FeatureDecisionContext, userContext entities.UserContext) (FeatureDecision, error)
GetDecision returns a decision for the given feature test and user context
type FeatureService ¶
type FeatureService interface {
GetDecision(decisionContext FeatureDecisionContext, userContext entities.UserContext) (FeatureDecision, error)
}
FeatureService can make a decision about a Feature Flag (can be feature test or rollout)
type MapExperimentOverridesStore ¶
type MapExperimentOverridesStore struct {
// contains filtered or unexported fields
}
MapExperimentOverridesStore is a map-based implementation of ExperimentOverridesStore that is safe to use concurrently
func NewMapExperimentOverridesStore ¶
func NewMapExperimentOverridesStore() *MapExperimentOverridesStore
NewMapExperimentOverridesStore returns a new MapExperimentOverridesStore
func (*MapExperimentOverridesStore) GetVariation ¶
func (m *MapExperimentOverridesStore) GetVariation(overrideKey ExperimentOverrideKey) (string, bool)
GetVariation returns the override variation key associated with the given user+experiment key
func (*MapExperimentOverridesStore) RemoveVariation ¶
func (m *MapExperimentOverridesStore) RemoveVariation(overrideKey ExperimentOverrideKey)
RemoveVariation removes the override variation key associated with the argument user+experiment key. If there is no override variation key set, this method has no effect.
func (*MapExperimentOverridesStore) SetVariation ¶
func (m *MapExperimentOverridesStore) SetVariation(overrideKey ExperimentOverrideKey, variationKey string)
SetVariation sets the given variation key as an override for the given user+experiment key
type PersistingExperimentService ¶
type PersistingExperimentService struct {
// contains filtered or unexported fields
}
PersistingExperimentService attempts to retrieve a saved decision from the user profile service for the user before having the ExperimentBucketerService compute it. If computed, the decision is saved back to the user profile service if provided.
func NewPersistingExperimentService ¶
func NewPersistingExperimentService(experimentBucketerService ExperimentService, userProfileService UserProfileService) *PersistingExperimentService
NewPersistingExperimentService returns a new instance of the PersistingExperimentService
func (PersistingExperimentService) GetDecision ¶
func (p PersistingExperimentService) GetDecision(decisionContext ExperimentDecisionContext, userContext entities.UserContext) (experimentDecision ExperimentDecision, err error)
GetDecision returns the decision with the variation the user is bucketed into
type RolloutService ¶
type RolloutService struct {
// contains filtered or unexported fields
}
RolloutService makes a feature decision for a given feature rollout
func NewRolloutService ¶
func NewRolloutService() *RolloutService
NewRolloutService returns a new instance of the Rollout service
func (RolloutService) GetDecision ¶
func (r RolloutService) GetDecision(decisionContext FeatureDecisionContext, userContext entities.UserContext) (FeatureDecision, error)
GetDecision returns a decision for the given feature and user context
type Service ¶
type Service interface { GetFeatureDecision(FeatureDecisionContext, entities.UserContext) (FeatureDecision, error) GetExperimentDecision(ExperimentDecisionContext, entities.UserContext) (ExperimentDecision, error) OnDecision(func(notification.DecisionNotification)) (int, error) RemoveOnDecision(id int) error }
Service interface is used to make a decision for a given feature or experiment
type UserDecisionKey ¶
UserDecisionKey is used to access the saved decisions in a user profile
func NewUserDecisionKey ¶
func NewUserDecisionKey(experimentID string) UserDecisionKey
NewUserDecisionKey returns a new UserDecisionKey with the given experiment ID
type UserProfile ¶
type UserProfile struct { ID string ExperimentBucketMap map[UserDecisionKey]string }
UserProfile represents a saved user profile
type UserProfileService ¶
type UserProfileService interface { Lookup(string) UserProfile Save(UserProfile) }
UserProfileService is used to save and retrieve past bucketing decisions for users
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package bucketer // Package bucketer //
|
Package bucketer // Package bucketer // |
Package evaluator // Package evaluator // Package evaluator //
|
Package evaluator // Package evaluator // Package evaluator // |
matchers
Package matchers // Package matchers // Package matchers // Package matchers // Package matchers // Package matchers //
|
Package matchers // Package matchers // Package matchers // Package matchers // Package matchers // Package matchers // |
matchers/utils
Package utils //
|
Package utils // |
Package reasons //
|
Package reasons // |