decision

package
v1.0.0-beta4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2019 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package decision //

Package decision //

Package decision //

Package decision //

Package decision //

Package decision //

Package decision //

Package decision //

Package decision //

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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() *CompositeExperimentService

NewCompositeExperimentService creates a new instance of the CompositeExperimentService

func (CompositeExperimentService) GetDecision

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 entrypoint into the decision service. It provides out of the box decision making for Features and Experiments.

func NewCompositeService

func NewCompositeService(sdkKey string) *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 Decision

type Decision struct {
	Reason reasons.Reason
}

Decision contains base information about a decision

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

GetDecision returns the decision with the variation the user is bucketed into

type ExperimentDecision

type ExperimentDecision struct {
	Decision
	Variation *entities.Variation
}

ExperimentDecision contains the decision information about an experiment

type ExperimentDecisionContext

type ExperimentDecisionContext struct {
	Experiment    *entities.Experiment
	ProjectConfig pkg.ProjectConfig
}

ExperimentDecisionContext contains the information needed to be able to make a decision for a given experiment

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

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 pkg.ProjectConfig
}

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 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 Source

type Source string

Source is where the decision came from

const (
	// Rollout - the decision came from a rollout
	Rollout Source = "rollout"
	// FeatureTest - the decision came from a feature test
	FeatureTest Source = "feature-test"
)

Directories

Path Synopsis
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 //

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL