model

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BinlogInsert = "insert"
	BinlogUpdate = "update"
	BinlogDelete = "delete"
)
View Source
const (
	Dispatch = "ds"
	Delay    = "dy"
	Submit   = "st_%d_%d" // 参数1:提交状态(任务提交,资源提交,任务关闭) 参数2:提交前属于谁
	Release  = "rl"
	RscState = "rs_%d"
	UseTime  = "ut"
	SetKey   = "report_set"

	//type
	TypeMeta  = int8(0)
	TypeTotal = int8(1)
)

hash fields

View Source
const (
	//初始状态
	TaskStateInit = int8(0)
	//已派发
	TaskStateDispatch = int8(1)
	//延迟
	TaskStateDelay = int8(2)
	//任务提交
	TaskStateSubmit = int8(3)
	//资源列表提交
	TaskStateRscSb = int8(4)
	//任务关闭
	TaskStateClosed = int8(5)

	// ActionCreate 生成任务
	ActionCreate = uint8(0)
	// ActionSeize 抢占任务
	ActionSeize = uint8(1)
	// ActionRelease 释放任务
	ActionRelease = uint8(2)
	// ActionDelay 延迟任务
	ActionDelay = uint8(3)
	// ActionSubmit 提交任务
	ActionSubmit = uint8(4)
	// ActionUnknow 其他变更
	ActionUnknow = uint8(5)

	LogBusinessTask     = int(232)
	LogTypeTaskDispatch = int(1)
	LogTypeTaskConsumer = int(2)
	LogTYpeTaskWeight   = int(3)

	// WeightTypeCycle 周期权重
	WeightTypeCycle = int8(0)
	// WeightTypeConst 定值权重
	WeightTypeConst = int8(1)
)

..

View Source
const (
	// ConfigStateOn .
	ConfigStateOn = int8(0)
	// ConfigStateOff .
	ConfigStateOff = int8(1)

	// ConsumerStateOn on
	ConsumerStateOn = int8(1)
	// ConsumerStateOff off
	ConsumerStateOff = int8(0)

	// ActionConsumerOff .
	ActionConsumerOff = int8(0)
	// ActionConsumerOn .
	ActionConsumerOn = int8(1)

	// TaskConfigAssign 指派
	TaskConfigAssign = int8(1)
	// TaskConfigRangeWeight 权重
	TaskConfigRangeWeight = int8(2)
	// TaskConfigEqualWeight 权重
	TaskConfigEqualWeight = int8(3)

	// TaskRoleMember 组员
	TaskRoleMember = int8(1)
	// TaskRoleLeader 组长
	TaskRoleLeader = int8(2)
)

Variables

This section is empty.

Functions

func ParseKey

func ParseKey(key string) (tp int8, bizid, flowid, uid int, err error)

ParseKey .

func PersonalHashKey

func PersonalHashKey(bizid, flowid, uid int64) string

PersonalHashKey .

func TotalHashKey

func TotalHashKey(bizid, flowid int64) string

TotalHashKey .

func WaitTime

func WaitTime(ctime xtime.Time) string

WaitTime 计算等待时长

Types

type AddOption

type AddOption struct {
	Resource
	State int   `form:"state" json:"state"`
	NetID int64 `form:"net_id" json:"net_id"`
}

AddOption add option

func (AddOption) ToQueryURI

func (opt AddOption) ToQueryURI() url.Values

ToQueryURI convert field to uri.

type AssignConfig

type AssignConfig struct {
	Admin int64   `json:"-"`
	Mids  []int64 `json:"mids"`
	Uids  []int64 `json:"uids"`
}

AssignConfig 指派

type BaseResponse

type BaseResponse struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

BaseResponse .

type BinLog

type BinLog struct {
	Action string          `json:"action"`
	Table  string          `json:"table"`
	New    json.RawMessage `json:"new"`
	Old    json.RawMessage `json:"old"`
	MTS    int64
}

BinLog databus binlog message.

type CancelOption

type CancelOption struct {
	BusinessID int64    `json:"business_id"`
	Oids       []string `json:"oids"`
	Reason     string   `json:"reason"`
}

CancelOption .

func (CancelOption) ToQueryURI

func (opt CancelOption) ToQueryURI() url.Values

ToQueryURI convert field to uri.

type ConfigItem

type ConfigItem struct {
	Name  string `json:"name"`
	Desc  string `json:"desc"`
	Uname string `json:"uname"`
}

ConfigItem .

type CreateTaskMsg

type CreateTaskMsg struct {
	BizID         int64 `json:"business_id"`
	RID           int64 `json:"rid"`
	FlowID        int64 `json:"flow_id"`
	DispatchLimit int64 `json:"dispatch_limit"`
}

CreateTaskMsg databus msg

type EqualWeightConfig

type EqualWeightConfig struct {
	Uname       string //  配置人
	Description string //  描述
	Name        string `json:"name"` // taskid 或者 mid
	IDs         string `json:"ids"`
	Weight      int64  `json:"weight"`
	Type        int8   `json:"type"` // 周期或者定值
}

EqualWeightConfig 等值权重

type IntTime

type IntTime int64

IntTime .

func (*IntTime) Scan

func (jt *IntTime) Scan(src interface{}) (err error)

Scan scan time.

func (IntTime) Time

func (jt IntTime) Time() xtime.Time

Time get time.

func (*IntTime) UnmarshalJSON

func (jt *IntTime) UnmarshalJSON(data []byte) error

UnmarshalJSON implement Unmarshaler

func (IntTime) Value

func (jt IntTime) Value() (driver.Value, error)

Value get time value.

type MoniTemp

type MoniTemp struct {
	From    string   `json:"from"`
	Members []string `json:"members"`
	Subject string   `json:"subject"`
	Body    string   `json:"body"`
}

MoniTemp 监控邮件模板

type RIR

type RIR struct {
	BizID  int64
	FlowID int64
	UID    int64
	RID    int64
}

RIR resource item report

type RangeConfig

type RangeConfig struct {
	Threshold int64 `json:"threshold"`
	Weight    int64 `json:"weight"`
}

RangeConfig 范围配置

type RangeWeightConfig

type RangeWeightConfig struct {
	Name  string         `json:"name"`
	Range []*RangeConfig `json:"range"`
}

RangeWeightConfig 权重

type Report

type Report struct {
	ID         int64  `gorm:"AUTO_INCREMENT;primary_key;"`
	BusinessID int64  `gorm:"column:business_id"`
	FlowID     int64  `gorm:"column:flow_id"`
	UID        int64  `gorm:"column:uid"`
	TYPE       int8   `gorm:"column:type"`
	Content    []byte `gorm:"column:content"`
}

Report .

func (Report) TableName

func (r Report) TableName() string

TableName .

type Resource

type Resource struct {
	ID         int64      `json:"id" gorm:"primary_key" form:"id"`
	BusinessID int64      `json:"business_id" gorm:"column:business_id" form:"business_id"`
	OID        string     `json:"oid" gorm:"column:oid" form:"oid"`
	MID        int64      `json:"mid" gorm:"column:mid" form:"mid"`
	Content    string     `json:"content" gorm:"column:content" form:"content"`
	Extra1     int64      `json:"extra1" gorm:"column:extra1" form:"extra1"`
	Extra2     int64      `json:"extra2" gorm:"column:extra2" form:"extra2"`
	Extra3     int64      `json:"extra3" gorm:"column:extra3" form:"extra3"`
	Extra4     int64      `json:"extra4" gorm:"column:extra4" form:"extra4"`
	Extra1s    string     `json:"extra1s" gorm:"column:extra1s" form:"extra1s"`
	Extra2s    string     `json:"extra2s" gorm:"column:extra2s" form:"extra2s"`
	MetaData   string     `json:"metadata" gorm:"column:metadata" form:"metadata"`
	Ctime      xtime.Time `json:"ctime" gorm:"column:ctime"`
	Mtime      xtime.Time `json:"mtime" gorm:"column:mtime"`
	Extra5     int64      `json:"extra5" gorm:"column:extra5" form:"extra5"`
	Extra6     int64      `json:"extra6" gorm:"column:extra6" form:"extra6"`
	Extra3s    string     `json:"extra3s" gorm:"column:extra3s" form:"extra3s"`
	Extra4s    string     `json:"extra4s" gorm:"column:extra4s" form:"extra4s"`
	ExtraTime1 string     `json:"extratime1" gorm:"column:extratime1" form:"extratime1"`
	OCtime     string     `json:"octime" gorm:"column:octime" form:"octime"`
	Ptime      string     `json:"ptime" gorm:"column:ptime" form:"ptime"`
}

Resource .

func (*Resource) TableName

func (t *Resource) TableName() string

TableName .

type RscMsg

type RscMsg struct {
	Action string          `json:"action"`
	BizID  int64           `json:"business_id"`
	Raw    json.RawMessage `json:"raw"`
}

RscMsg databus resource message

type Task

type Task struct {
	ID         int64   `form:"id" json:"id" gorm:"AUTO_INCREMENT;primary_key;"`
	BusinessID int64   `form:"business_id" json:"business_id" gorm:"column:business_id"`
	FlowID     int64   `form:"flow_id" json:"flow_id" gorm:"column:flow_id"`
	RID        int64   `form:"rid" json:"rid" gorm:"column:rid"`
	AdminID    int64   `form:"admin_id" json:"admin_id" gorm:"column:admin_id"`
	UID        int64   `form:"uid" json:"uid" gorm:"column:uid"`
	State      int8    `form:"state" json:"state" gorm:"column:state"`
	Weight     int64   `form:"weight" json:"weight" gorm:"column:weight"`
	Utime      int64   `form:"utime" json:"utime" gorm:"column:utime"`
	Gtime      IntTime `form:"gtime" json:"gtime" gorm:"column:gtime"`
	MID        int64   `form:"mid" json:"mid" gorm:"column:mid"`
	Fans       int64   `form:"fans" json:"fans" gorm:"column:fans"`
	Group      string  `form:"group" json:"group" gorm:"column:group"`
	Reason     string  `form:"reason" json:"reason" grom:"column:reason"`
	Ctime      IntTime `form:"ctime" json:"ctime" gorm:"column:ctime"`
	Mtime      IntTime `form:"mtime" json:"mtime" gorm:"column:mtime"`
}

Task ..

type TaskConfig

type TaskConfig struct {
	ID          int64        `form:"id" json:"id" gorm:"AUTO_INCREMENT;primary_key;"`
	ConfJSON    string       `json:"conf_json" gorm:"column:conf_json"`
	ConfType    int8         `form:"conf_type" json:"conf_type" gorm:"column:conf_type"`
	BusinessID  int64        `form:"business_id" json:"business_id" gorm:"column:business_id"`
	FlowID      int64        `form:"flow_id" json:"flow_id" gorm:"column:flow_id"`
	Btime       libtime.Time `form:"btime" json:"btime" gorm:"column:btime"`
	Etime       libtime.Time `form:"etime" json:"etime" gorm:"column:etime"`
	State       int8         `form:"state" json:"state" gorm:"column:state"`
	UID         int64        `form:"uid" json:"uid" gorm:"column:uid"`
	Uname       string       `form:"uname" json:"uname" gorm:"column:uname"`
	Description string       `form:"description" json:"description" gorm:"column:description"`
	Ctime       libtime.Time `form:"ctime" json:"ctime" gorm:"column:ctime"`
	Mtime       libtime.Time `form:"mtime" json:"mtime" gorm:"column:mtime"`
}

TaskConfig .

func (TaskConfig) TableName

func (TaskConfig) TableName() string

TableName for orm

type UpdateOption

type UpdateOption struct {
	BusinessID int64                  `json:"business_id"`
	NetID      int64                  `json:"net_id"`
	OID        string                 `json:"oid"`
	Update     map[string]interface{} `json:"update"`
}

UpdateOption update option

func (UpdateOption) ToQueryURI

func (opt UpdateOption) ToQueryURI() url.Values

ToQueryURI convert field to uri.

type WeightItem

type WeightItem struct {
	ID     int64
	Weight int64
}

WeightItem 权重值

type WeightLog

type WeightLog struct {
	UPtime      string        `json:"uptime"`
	Mid         int64         `json:"mid"`
	Fans        int64         `json:"fans"`
	FansWeight  int64         `json:"fans_weight"`
	Group       string        `json:"group"`
	GroupWeight int64         `json:"group_weight"`
	WaitTime    string        `json:"wait_time"`
	WaitWeight  int64         `json:"wait_weight"`
	EqualWeight int64         `json:"config_weight"`
	ConfigItems []*ConfigItem `json:"config_items"`
	Weight      int64         `json:"weight"`
}

WeightLog task log

type WeightOPT

type WeightOPT struct {
	BusinessID   int64
	FlowID       int64
	TopListLen   int64
	BatchListLen int64
	RedisListLen int64
	DbListLen    int64
	AssignLen    int64
	Minute       int64
}

WeightOPT .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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