model

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 10 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEmptySceneParams

func NewEmptySceneParams() *emptySceneParams

func NewLayerParams

func NewLayerParams() *layerParams

func NewSceneParams

func NewSceneParams() *sceneParams

Types

type CustomDiversionBucket

type CustomDiversionBucket struct {
}

func NewCustomDiversionBucket

func NewCustomDiversionBucket() *CustomDiversionBucket

func (*CustomDiversionBucket) Match

func (b *CustomDiversionBucket) Match(experimentContext *ExperimentContext) bool

type DiversionBucket

type DiversionBucket interface {
	Match(*ExperimentContext) bool
}

DiversionBucket is a interface by the bucket type to match diversion

func NewDiversionBucket

func NewDiversionBucket(bucketType uint32) DiversionBucket

type EmptyLayerParams

type EmptyLayerParams struct {
}

func NewEmptyLayerParams

func NewEmptyLayerParams() *EmptyLayerParams

func (*EmptyLayerParams) AddParam

func (r *EmptyLayerParams) AddParam(key string, value interface{})

func (*EmptyLayerParams) AddParams

func (r *EmptyLayerParams) AddParams(params map[string]interface{})

func (*EmptyLayerParams) Get

func (r *EmptyLayerParams) Get(key string, defaultValue interface{}) interface{}

func (*EmptyLayerParams) GetFloat

func (r *EmptyLayerParams) GetFloat(key string, defaultValue float64) float64

func (*EmptyLayerParams) GetInt

func (r *EmptyLayerParams) GetInt(key string, defaultValue int) int

func (*EmptyLayerParams) GetInt64

func (r *EmptyLayerParams) GetInt64(key string, defaultValue int64) int64

func (*EmptyLayerParams) GetString

func (r *EmptyLayerParams) GetString(key, defaultValue string) string

type Experiment

type Experiment struct {
	ExperimentId      int64  `json:"experiment_id,omitempty"`
	ExpGroupId        int64  `json:"exp_group_id"`
	LayerId           int64  `json:"layer_id,omitempty"`
	ExpRoomId         int64  `json:"exp_room_id,omitempty"`
	SceneId           int64  `json:"scene_id,omitempty"`
	ExperimentName    string `json:"experiment_name"`
	ExperimentInfo    string `json:"experiment_info"`
	Type              uint32 `json:"type"`
	ExperimentFlow    uint32 `json:"experiment_flow,omitempty"`
	ExperimentBuckets string `json:"experiment_buckets,omitempty"`
	DebugUsers        string `json:"debug_users,omitempty"`
	DebugCrowdId      int64  `json:"debug_crowd_id,omitempty"`
	ExperimentConfig  string `json:"experiment_config,omitempty"`
	Status            int32  `json:"status,omitempty"`

	DebugCrowdUsers []string `json:"debug_crowd_users"`
	// contains filtered or unexported fields
}

func (*Experiment) Clone

func (e *Experiment) Clone() *Experiment

func (*Experiment) Init

func (e *Experiment) Init() error

Init is a function of init experiment data

func (*Experiment) Match

func (e *Experiment) Match(experimentContext *ExperimentContext) bool

func (*Experiment) MatchDebugUsers

func (e *Experiment) MatchDebugUsers(experimentContext *ExperimentContext) bool

MatchDebugUsers return true if debug_users is set and debug_users contain of uid

type ExperimentContext

type ExperimentContext struct {
	RequestId string

	// Uid
	Uid string

	// FilterParams is map of params, use for filter condition
	FilterParams map[string]interface{}
	// contains filtered or unexported fields
}

func (*ExperimentContext) ExperimentHashString

func (c *ExperimentContext) ExperimentHashString() string

func (*ExperimentContext) SetExperimentHashString

func (c *ExperimentContext) SetExperimentHashString(str string)

type ExperimentGroup

type ExperimentGroup struct {
	ExpGroupId               int64  `json:"exp_group_id,omitempty"`
	LayerId                  int64  `json:"layer_id"`
	ExpRoomId                int64  `json:"exp_room_id,omitempty"`
	SceneId                  int64  `json:"scene_id,omitempty"`
	ExpGroupName             string `json:"exp_group_name"`
	ExpGroupInfo             string `json:"exp_group_info"`
	DebugUsers               string `json:"debug_users,omitempty"`
	DebugCrowdId             int64  `json:"debug_crowd_id,omitempty"`
	Owner                    string `json:"owner"`
	Filter                   string `json:"filter,omitempty"`
	DistributionType         int    `json:"distribution_type,omitempty"`
	DistributionTimeDuration int    `json:"distribution_time_duration,omitempty"`
	CrowdId                  int64  `json:"crowd_id,omitempty"`
	ExpGroupConfig           string `json:"exp_group_config,omitempty"`
	ReserveBuckets           string `json:"reserve_buckets,omitempty"`
	Status                   int32  `json:"status,omitempty"`

	Experiments []*Experiment `json:"experiments"`

	DebugCrowdUsers []string `json:"debug_crowd_users"`

	CrowdUsers []string
	// contains filtered or unexported fields
}

func (*ExperimentGroup) AddExperiment

func (e *ExperimentGroup) AddExperiment(experiment *Experiment)

func (*ExperimentGroup) Init

func (e *ExperimentGroup) Init() error

func (*ExperimentGroup) Match

func (e *ExperimentGroup) Match(experimentContext *ExperimentContext) bool

type ExperimentResult

type ExperimentResult struct {
	ExperimentContext *ExperimentContext

	// ExperimentRoom is the result of the match ExperimentRoom
	ExperimentRoom *ExperimentRoom

	// Layers is a list of the layer, the match ExperimentRoom has layers list here
	Layers []*Layer

	// ExpId is path of match experiment ,  from experiment room to experiment
	// Example: ER2_L1#EG1#E2_L2#EG1#E3_L3#EG1#E6
	ExpId string

	SceneName string
	// contains filtered or unexported fields
}

ExperimentResult is the result match by ExperimentContext

func NewExperimentResult

func NewExperimentResult(sceneName string, experimentContext *ExperimentContext) *ExperimentResult

func (*ExperimentResult) AddMatchExperiment

func (r *ExperimentResult) AddMatchExperiment(layerName string, experiment *Experiment)

func (*ExperimentResult) AddMatchExperimentGroup

func (r *ExperimentResult) AddMatchExperimentGroup(layerName string, experimentGroup *ExperimentGroup)

func (*ExperimentResult) ContainsLayer

func (r *ExperimentResult) ContainsLayer(layerName string) bool

func (*ExperimentResult) GetExpId

func (r *ExperimentResult) GetExpId() string

func (*ExperimentResult) GetExperimentParams

func (r *ExperimentResult) GetExperimentParams() LayerParams

func (*ExperimentResult) GetLayerParams

func (r *ExperimentResult) GetLayerParams(layerName string) LayerParams

func (*ExperimentResult) Info

func (r *ExperimentResult) Info() string

func (*ExperimentResult) Init

func (r *ExperimentResult) Init()

func (*ExperimentResult) LayerSize

func (r *ExperimentResult) LayerSize() int

type ExperimentRoom

type ExperimentRoom struct {
	ExpRoomId      int64  `json:"exp_room_id,omitempty"`
	SceneId        int64  `json:"scene_id"`
	ExpRoomName    string `json:"exp_room_name"`
	ExpRoomInfo    string `json:"exp_room_info"`
	DebugUsers     string `json:"debug_users,omitempty"`
	DebugCrowdId   int64  `json:"debug_crowd_id,omitempty"`
	BucketCount    int32  `json:"bucket_count,omitempty"`
	ExpRoomBuckets string `json:"exp_room_buckets,omitempty"`
	BucketType     uint32 `json:"bucket_type"`
	Filter         string `json:"filter"`
	ExpRoomConfig  string `json:"exp_room_config,omitempty"`
	Environment    int32  `json:"environment"`
	//EnvironmentStr string `json:"-"`
	Type   uint32 `json:"type"`
	Status int32  `json:"status,omitempty"`

	DebugCrowdIdUsers []string `json:"debug_crowd_id_users"`

	Layers []*Layer `json:"layers"`
	// contains filtered or unexported fields
}

func (*ExperimentRoom) AddLayer

func (e *ExperimentRoom) AddLayer(l *Layer)

func (*ExperimentRoom) Init

func (e *ExperimentRoom) Init() error

func (*ExperimentRoom) Match

func (e *ExperimentRoom) Match(experimentContext *ExperimentContext) bool

func (*ExperimentRoom) MatchDebugUsers

func (e *ExperimentRoom) MatchDebugUsers(experimentContext *ExperimentContext) bool

MatchDebugUsers return true if debug_users is set and debug_users contain of uid

type FeatureConsistencyJob

type FeatureConsistencyJob struct {
	JobId                                int    `json:"job_id"`
	JobName                              string `json:"job_name,omitempty"`
	SceneId                              int    `json:"scene_id"`
	SampleRate                           int    `json:"sample_rate"`
	FeatureBackflowQueueType             string `json:"feature_backflow_queue_type"`
	FeatureBackflowQueueDatahubAccessId  string `json:"feature_backflow_queue_datahub_access_id,omitempty"`
	FeatureBackflowQueueDatahubAccessKey string `json:"feature_backflow_queue_datahub_access_key,omitempty"`
	FeatureBackflowQueueDatahubEndpoint  string `json:"feature_backflow_queue_datahub_endpoint,omitempty"`
	FeatureBackflowQueueDatahubProject   string `json:"feature_backflow_queue_datahub_project,omitempty"`
	FeatureBackflowQueueDatahubTopic     string `json:"feature_backflow_queue_datahub_topic,omitempty"`
	FeatureBackflowEASVpcAddress         string `json:"feature_backflow_eas_vpc_address"`
	FeatureBackflowEASToken              string `json:"feature_backflow_eas_token"`
	EasModelUrl                          string `json:"eas_model_url"`
	NeedFeatureReply                     int    `json:"need_feature_reply"`
	FeatureReplyHost                     string `json:"feature_reply_host,omitempty"`
	FeatureReplyToken                    string `json:"feature_reply_token,omitempty"`
	FeatureReplyQueueType                string `json:"feature_reply_queue_type,omitempty"`
	FeatureReplyQueueDatahubAccessId     string `json:"feature_reply_queue_datahub_access_id,omitempty"`
	FeatureReplyQueueDatahubAccessKey    string `json:"feature_reply_queue_datahub_access_key,omitempty"`
	FeatureReplyQueueDatahubEndpoint     string `json:"feature_reply_queue_datahub_endpoint,omitempty"`
	FeatureReplyQueueDatahubProject      string `json:"feature_reply_queue_datahub_project,omitempty"`
	FeatureReplyQueueDatahubTopic        string `json:"feature_reply_queue_datahub_topic,omitempty"`
	FeatureReplyEASVpcAddress            string `json:"feature_reply_eas_vpc_address"`
	FeatureReplyEASToken                 string `json:"feature_reply_eas_token"`
	Status                               int    `json:"status"`
	StartTime                            int64  `json:"start_time"`
	EndTime                              int64  `json:"end_time"`
}

type FilterDiversionBucket

type FilterDiversionBucket struct {
	Filter              string
	EvaluableExpression *govaluate.EvaluableExpression
}

func NewFilterDiversionBucket

func NewFilterDiversionBucket(filter string) (*FilterDiversionBucket, error)

NewFilterDiversionBucket return instance of FilterDiversionBucket

func (*FilterDiversionBucket) Match

func (b *FilterDiversionBucket) Match(experimentContext *ExperimentContext) bool

Match is a function of FilterDiversionBucket implements the DiversionBucket interface

type FlowCtrlPlan

type FlowCtrlPlan struct {
	PlanId                        int                   `json:"plan_id"`
	SceneId                       int                   `json:"scene_id"`
	SceneName                     string                `json:"scene_name"`
	PlanName                      string                `json:"plan_name"`
	PlanDesc                      string                `json:"plan_desc"`
	OnlineDatasourceType          string                `json:"online_datasource_type"`
	OnlineDatasourceId            int                   `json:"online_datasource_id"`
	OnlineTableName               string                `json:"online_table_name"`
	OnlineTableItemIdField        string                `json:"online_table_item_id_field"`
	PlanScopeFilter               string                `json:"plan_scope_filter"`
	PlanScopeFilterJson           string                `json:"plan_scope_filter_json"`
	TargetValueInPercentageFormat bool                  `json:"target_value_in_percentage_format"`
	PlanType                      string                `json:"plan_type"`
	Granularity                   string                `json:"granularity"`
	RealtimeLogType               string                `json:"realtime_log_type"`
	RealtimeLogTableMetaId        int                   `json:"realtime_log_table_meta_id"`
	RealtimeLogFilter             string                `json:"RealtimeLogFilter"`
	RealtimeLogFilterJson         string                `json:"realtime_log_filter_json"`
	FlowScopeFilterJson           string                `json:"flow_scope_filter_json"`
	LoadTrafficByPlan             bool                  `json:"load_traffic_by_plan"`
	StartTime                     time.Time             `json:"start_time"`
	EndTime                       time.Time             `json:"end_time"`
	Status                        string                `json:"status"`
	CreateTime                    time.Time             `json:"create_time"`
	Targets                       []FlowCtrlPlanTargets `json:"targets"`
}

type FlowCtrlPlanTargets

type FlowCtrlPlanTargets struct {
	TargetId              int                `json:"target_id"`
	PlanId                int                `json:"planId"`
	TargetName            string             `json:"target_name"`
	TargetType            int                `json:"target_type"`
	TargetScopeFilter     string             `json:"target_scope_filter"`
	TargetScopeFilterJson string             `json:"target_scope_filter_json"`
	ItemScopeFilterJson   string             `json:"item_scope_filter_json"`
	TimeUint              string             `json:"time_uint"`
	SetPoint              float64            `json:"set_point"`
	SetPointRange         float64            `json:"set_point_range"`
	DoRecall              bool               `json:"do_recall"`
	Status                string             `json:"status"`
	StartTime             time.Time          `json:"start_time"`
	EndTime               time.Time          `json:"end_time"`
	CreateTime            time.Time          `json:"create_time"`
	TargetTraffics        map[string]float64 `json:"target_traffics"`
	PlanTraffic           map[string]float64 `json:"plan_traffics"`
	TimePoints            []int              `json:"time_points"`
	SetPoints             []float64          `json:"set_points"`
}

type Layer

type Layer struct {
	LayerId   int64  `json:"layer_id,omitempty"`
	ExpRoomId int64  `json:"exp_room_id"`
	SceneId   int64  `json:"scene_id"`
	LayerName string `json:"layer_name"`
	LayerInfo string `json:"layer_info"`

	ExperimentGroups []*ExperimentGroup `json:"experiment_groups"`
}

func (*Layer) AddExperimentGroup

func (l *Layer) AddExperimentGroup(g *ExperimentGroup)

type LayerParams

type LayerParams interface {
	AddParam(key string, value interface{})

	AddParams(params map[string]interface{})

	Get(key string, defaultValue interface{}) interface{}

	GetString(key, defaultValue string) string

	GetInt(key string, defaultValue int) int

	GetFloat(key string, defaultValue float64) float64

	GetInt64(key string, defaultValue int64) int64
}

LayerParams offers Get* function to get value by the key If not found the key, defaultValue will return

func MergeLayerParams

func MergeLayerParams(layersParamsMap map[string]LayerParams) LayerParams

type Param

type Param struct {
	ParamId     int64  `json:"param_id,omitempty"`
	SceneId     int64  `json:"scene_id"`
	ParamName   string `json:"param_name"`
	ParamValue  string `json:"param_value"`
	Environment int32  `json:"environment"`
	Scene       *Scene `json:"scene"`
}

type Scene

type Scene struct {
	SceneId         int64             `json:"scene_id,omitempty"`
	SceneName       string            `json:"scene_name"`
	SceneInfo       string            `json:"scene_info"`
	ExperimentRooms []*ExperimentRoom `json:"experiment_rooms"`
}

func (*Scene) AddExperimentRoom

func (s *Scene) AddExperimentRoom(room *ExperimentRoom)

type SceneParams

type SceneParams interface {
	AddParam(key string, value interface{})

	AddParams(params map[string]interface{})

	Get(key string, defaultValue interface{}) interface{}

	GetString(key, defaultValue string) string

	GetInt(key string, defaultValue int) int

	GetFloat(key string, defaultValue float64) float64

	GetInt64(key string, defaultValue int64) int64

	GetFeatureConsistencyJobs() []*FeatureConsistencyJob
}

SceneParams offers Get* function to get value by the key If not found the key, defaultValue will return

type UidDiversionBucket

type UidDiversionBucket struct {
	// contains filtered or unexported fields
}

func NewUidDiversionBucket

func NewUidDiversionBucket(bucketCount int, bucketStr string) *UidDiversionBucket

func (*UidDiversionBucket) Match

func (b *UidDiversionBucket) Match(experimentContext *ExperimentContext) bool

type UidHashDiversionBucket

type UidHashDiversionBucket struct {
	*UidDiversionBucket
}

func NewUidHashDiversionBucket

func NewUidHashDiversionBucket(bucketCount int, bucketStr string) *UidHashDiversionBucket

func (*UidHashDiversionBucket) Match

func (b *UidHashDiversionBucket) Match(experimentContext *ExperimentContext) bool

Jump to

Keyboard shortcuts

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