service

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: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTaskMiss = errors.New("task miss")
)

ERROR

Functions

This section is empty.

Types

type AggrCacheDest

type AggrCacheDest struct {
	Dest        map[int64][]int64
	GetKey      FCacheKeyPro
	AggrRelaRaw FCacheAggregateRelation
}

AggrCacheDest 聚合缓存

func (*AggrCacheDest) AppendRelationRaw

func (a *AggrCacheDest) AppendRelationRaw(c context.Context, miss []int64, kopt []interface{}, opt ...interface{}) (missCache map[string]string, err error)

AppendRelationRaw 根据聚合字段值,从db获取聚合字段与对象id的关联

func (*AggrCacheDest) AppendString

func (a *AggrCacheDest) AppendString(id int64, v string) (ok bool, err error)

AppendString 实现ICacheDecoder接口

type CacheWrap

type CacheWrap struct {
	ObjDest       ICacheObjDest   //对象集合
	AggrObjRaw    FCacheRawByAggr //根据聚合字段获取对象集合from db
	AggregateDest *AggrCacheDest  //对象的某个聚合字段与对象id的集合
}

CacheWrap 以net对象为例子,可以根据business_id字段聚合

func (*CacheWrap) AppendAggregateRaw

func (w *CacheWrap) AppendAggregateRaw(c context.Context, miss []int64, kopt []interface{}, opt ...interface{}) (missCache map[string]string, err error)

AppendAggregateRaw 从db获取聚合字段映射的对象集合&关联

type FCacheAggregateRelation

type FCacheAggregateRelation func(c context.Context, miss []int64, kopt []interface{}, opt ...interface{}) (rela map[int64][]int64, err error)

FCacheAggregateRelation db获取聚合字段和对象id的关联

type FCacheKeyPro

type FCacheKeyPro func(id int64, opt ...interface{}) (k []string)

FCacheKeyPro 根据id获取key

type FCacheRawByAggr

type FCacheRawByAggr func(c context.Context, miss []int64, objDest ICacheObjDest, kopt []interface{}, opt ...interface{}) (objCache map[string]string, aggrRelation map[int64][]int64, err error)

FCacheRawByAggr db根据聚合值,获取对象集合和关联

type ICacheDecoder

type ICacheDecoder interface {
	//--get from cache, to decode & append to dest, && check null
	AppendString(id int64, v string) (ok bool, err error)
}

ICacheDecoder 解析字符串

type ICacheObjDest

type ICacheObjDest interface {
	//GetKey 获取对象缓存的key
	GetKey(id int64, opt ...interface{}) (k []string)
	//AppendString--v is from cache, to decode & append to dest, && check null
	AppendString(id int64, v string) (ok bool, err error)
	//AppendRaw--get from db, to encode & append to dest & to convert to string
	AppendRaw(c context.Context, s *Service, miss []int64, kopt []interface{}, opt ...interface{}) (missCache map[string]string, err error)
}

ICacheObjDest 对象缓存接口

type Service

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

Service struct

func New

func New(c *conf.Config) (s *Service)

New init

func (*Service) Add

func (s *Service) Add(c context.Context, opt *model.AddOption) (err error)

Add 业务方添加资源

func (*Service) AddBizCFG

func (s *Service) AddBizCFG(c context.Context, b *business.BizCFG) (lastid int64, err error)

AddBizCFG .

func (*Service) AddBusiness

func (s *Service) AddBusiness(c context.Context, b *business.Business) (id int64, err error)

AddBusiness .

func (*Service) AddConfig

func (s *Service) AddConfig(c context.Context, config *task.Config, confJSON interface{}) (err error)

AddConfig .

func (*Service) AddDirection

func (s *Service) AddDirection(c context.Context, uid int64, d *net.DirEditParam) (id int64, err error, msg string)

AddDirection .

func (*Service) AddFlow

func (s *Service) AddFlow(c context.Context, uid int64, f *net.FlowEditParam) (id int64, err error, msg string)

AddFlow .

func (*Service) AddNet

func (s *Service) AddNet(c context.Context, n *net.Net) (id int64, err error, msg string)

AddNet .

func (*Service) AddToken

func (s *Service) AddToken(c context.Context, t *net.Token) (id int64, err error, msg string)

AddToken .

func (*Service) AddTransition

func (s *Service) AddTransition(c context.Context, uid int64, f *net.TransitionEditParam) (id int64, err error, msg string)

AddTransition .

func (*Service) AttributeCFG

func (s *Service) AttributeCFG(c context.Context, bizid int64) (attrcfg map[string]uint, err error)

AttributeCFG 属性位配置

func (*Service) Auth

func (s *Service) Auth(c context.Context, uid int64) (a *model.Auth, err error)

Auth 用户权限查询

func (*Service) BatchSubmit

func (s *Service) BatchSubmit(c context.Context, opt *model.BatchOption) (tip *model.Tip, err error)

BatchSubmit 批量提交, 超过10个的做异步

func (*Service) Business

func (s *Service) Business(c context.Context, b *business.Business) (res *business.Business, err error)

Business .

func (*Service) BusinessList

func (s *Service) BusinessList(c context.Context, businessID []int64, onlyEnable bool) (res []*business.Business, err error)

BusinessList .

func (*Service) Cache

func (s *Service) Cache() map[string]interface{}

Cache .

func (*Service) Cancel

func (s *Service) Cancel(c context.Context, businessID int64, oids []string, uid int64, username string) (err error)

Cancel 取消相关资源的所有流程

func (*Service) CancelByOper

func (s *Service) CancelByOper(c context.Context, businessID int64, oids []string, uid int64, username string) (err error)

CancelByOper 手动删除任务

func (*Service) CheckResource

func (s *Service) CheckResource(c context.Context, opt *model.AddOption) (rid int64, err error)

CheckResource .

func (*Service) Close

func (s *Service) Close()

Close Service

func (*Service) Debug

func (s *Service) Debug() string

Debug .

func (*Service) Delay

func (s *Service) Delay(c context.Context, opt *taskmod.DelayOptions) (err error)

Delay 延迟任务

func (*Service) DeleteConfig

func (s *Service) DeleteConfig(c context.Context, id int64) (err error)

DeleteConfig .

func (*Service) FetchJumpFlowInfo

func (s *Service) FetchJumpFlowInfo(c context.Context, flowID int64) (res *net.JumpInfo, err error)

FetchJumpFlowInfo .. * 跳流程详情页, 跳流程是单独db层面的更新 * 参数:flowid(可选) * 获取网下所有flow和变迁的所有操作项

func (*Service) FlushRole

func (s *Service) FlushRole(c context.Context, BizID, flowID int64, uids []int64) (err error)

FlushRole .

func (*Service) GetDirectionList

func (s *Service) GetDirectionList(c context.Context, pm *net.ListDirectionParam) (result *net.ListDirectionRes, err error)

GetDirectionList .

func (*Service) GetFlowByNet

func (s *Service) GetFlowByNet(c context.Context, netID int64) (result map[int64]string, err error)

GetFlowByNet .

func (*Service) GetFlowList

func (s *Service) GetFlowList(c context.Context, pm *net.ListNetElementParam) (result *net.ListFlowRes, err error)

GetFlowList .

func (*Service) GetMiddlewareCache

func (s *Service) GetMiddlewareCache(bizid int64) []*middleware.Aggregate

GetMiddlewareCache get cache by bizid

func (*Service) GetNetByBusiness

func (s *Service) GetNetByBusiness(c context.Context, businessID int64) (res map[int64]string, err error)

GetNetByBusiness .

func (*Service) GetNetList

func (s *Service) GetNetList(c context.Context, pm *net.ListNetParam) (result *net.ListNetRes, err error)

GetNetList .

func (*Service) GetRole

func (s *Service) GetRole(c context.Context, opt *common.BaseOptions) (uname string, role int8, err error)

GetRole .

func (*Service) GetRoleBiz

func (s *Service) GetRoleBiz(c context.Context, uid int64, role string, noAdmin bool) (businessID []int64, err error)

GetRoleBiz uid能查看哪些业务

func (*Service) GetTaskBizFlows

func (s *Service) GetTaskBizFlows(c context.Context, uid int64) (businessID []int64, flows []int64, err error)

GetTaskBizFlows uid能查看哪些任务节点

func (*Service) GetTokenList

func (s *Service) GetTokenList(c context.Context, pm *net.ListTokenParam) (result *net.ListTokenRes, err error)

GetTokenList .

func (*Service) GetTranByNet

func (s *Service) GetTranByNet(c context.Context, netID int64) (result map[int64]string, err error)

GetTranByNet .

func (*Service) GetTransitionList

func (s *Service) GetTransitionList(c context.Context, pm *net.ListNetElementParam) (result *net.ListTransitionRes, err error)

GetTransitionList .

func (*Service) Gray

func (s *Service) Gray(opt *model.AddOption) (next bool)

Gray 灰度

func (*Service) InfoResource

func (s *Service) InfoResource(c context.Context, opt *common.BaseOptions) (info *model.AuditInfo, err error)

InfoResource .

func (*Service) InfoTask

func (s *Service) InfoTask(c context.Context, opt *common.BaseOptions, taskid int64) (info *model.AuditInfo, err error)

InfoTask .

func (*Service) IsAdmin

func (s *Service) IsAdmin(uid int64) bool

IsAdmin uid是否为管理员

func (*Service) IsOn

func (s *Service) IsOn(c context.Context, opt *common.BaseOptions) bool

IsOn .

func (*Service) JumpFlow

func (s *Service) JumpFlow(c context.Context, opt *model.SubmitOptions) (err error)

JumpFlow 跳流程提交

func (*Service) KickOut

func (s *Service) KickOut(c context.Context, opt *common.BaseOptions, kickuid int64) (err error)

KickOut 踢出

func (*Service) ListBizCFGs

func (s *Service) ListBizCFGs(c context.Context, bizid int64) (res []*business.BizCFG, err error)

ListBizCFGs .

func (*Service) ListBizFlow

func (s *Service) ListBizFlow(c context.Context, tp int8, bizID []int64, flowID []int64) (list []*business.BizItem, err error)

ListBizFlow .

func (*Service) ListByResource

func (s *Service) ListByResource(c context.Context, arg *model.SearchParams) (columns []*model.Column, list []*model.ListRscItem, op []*net.TranOperation, err error)

ListByResource 资源列表

func (*Service) ListByTask

func (s *Service) ListByTask(c context.Context, opt *taskmod.ListOptions) (list []*model.ListTaskItem, err error)

ListByTask 任务列表

func (*Service) ListTasks

func (s *Service) ListTasks(c context.Context, opt *taskmod.ListOptions) (tasks []*taskmod.Task, count int64, err error)

ListTasks 实时列表,停滞列表,延迟列表

func (*Service) MaxWeight

func (s *Service) MaxWeight(c context.Context, opt *common.BaseOptions) (max int64, err error)

MaxWeight 当前最高权重

func (*Service) MemberStats

func (s *Service) MemberStats(c context.Context, bizid, flowid int64, uids []int64) (res map[int64][]interface{}, err error)

MemberStats . 统计个人24h 处理量 处理率 通过率 平均耗时

func (*Service) MonitorBuzResult

func (s *Service) MonitorBuzResult(c context.Context, bid int64) (res []*monitor.RuleResultData, err error)

MonitorBuzResult 获取业务的监控结果

func (*Service) MonitorResultOids

func (s *Service) MonitorResultOids(c context.Context, rid int64) (res map[int64]int, err error)

MonitorResultOids 获取

func (*Service) NetSVG

func (s *Service) NetSVG(c context.Context, netid int64) (nv *svg.NetView, err error)

NetSVG 绘制网的svg图

func (*Service) Next

func (s *Service) Next(c context.Context, opt *taskmod.NextOptions) (infos []*model.AuditInfo, err error)

Next reveive next auditing task

func (*Service) NextTask

func (s *Service) NextTask(c context.Context, opt *taskmod.NextOptions) (tasks []*taskmod.Task, count int64, err error)

NextTask 下一个任务

func (*Service) Off

func (s *Service) Off(c context.Context, opt *common.BaseOptions) (err error)

Off 离线

func (*Service) On

func (s *Service) On(c context.Context, opt *common.BaseOptions) (err error)

On 上线

func (*Service) Ping

func (s *Service) Ping(c context.Context) (err error)

Ping Service

func (*Service) QueryConfigs

func (s *Service) QueryConfigs(c context.Context, queryParams *task.QueryParams) (ls []*task.Config, count int64, err error)

QueryConfigs .

func (*Service) Release

func (s *Service) Release(c context.Context, opt *common.BaseOptions, delay bool) (rows int64, err error)

Release 释放任务

func (*Service) ReportTaskSubmit

func (s *Service) ReportTaskSubmit(c context.Context, pm *model.OptReportSubmit) (res *model.ReportSubmitRes, err error)

ReportTaskSubmit 业务节点下的任务提交统计信息, 按天分页

func (*Service) ReportTaskflow

func (s *Service) ReportTaskflow(c context.Context, opt *model.OptReport) (res map[string][]*model.ReportFlowItem, form map[string][24]*model.ReportFlowItem, err error)

ReportTaskflow .

func (*Service) ReserveCFG

func (s *Service) ReserveCFG(c context.Context, bizid int64) (rsvcfg map[string]interface{}, err error)

ReserveCFG 保留字配置

func (*Service) ResourceRes

func (s *Service) ResourceRes(c context.Context, args *resource.Args) (res *resource.Res, err error)

ResourceRes .

func (*Service) SearchAuditLog

func (s *Service) SearchAuditLog(c context.Context, pm *model.SearchAuditLogParam) (res []*model.SearchAuditLog, p common.Pager, err error)

SearchAuditLog 查询审核日志

func (*Service) SearchAuditLogCSV

func (s *Service) SearchAuditLogCSV(c context.Context, pm *model.SearchAuditLogParam) (csv [][]string, err error)

SearchAuditLogCSV 操作日志结果csv

func (*Service) SetBusinessState

func (s *Service) SetBusinessState(c context.Context, b *business.Business) (err error)

SetBusinessState .

func (*Service) SetStateConfig

func (s *Service) SetStateConfig(c context.Context, id int64, state int8) (err error)

SetStateConfig .

func (*Service) ShowDirection

func (s *Service) ShowDirection(c context.Context, id int64) (r *net.ShowDirectionResult, err error)

ShowDirection .

func (*Service) ShowFlow

func (s *Service) ShowFlow(c context.Context, id int64) (r *net.ShowFlowResult, err error)

ShowFlow .

func (*Service) ShowNet

func (s *Service) ShowNet(c context.Context, id int64) (r *net.Net, err error)

ShowNet .

func (*Service) ShowToken

func (s *Service) ShowToken(c context.Context, id int64) (n *net.Token, err error)

ShowToken .

func (*Service) ShowTransition

func (s *Service) ShowTransition(c context.Context, id int64) (r *net.ShowTransitionResult, err error)

ShowTransition .

func (*Service) Submit

func (s *Service) Submit(c context.Context, opt *model.SubmitOptions) (err error)

Submit .

func (*Service) SwitchDirection

func (s *Service) SwitchDirection(c context.Context, id int64, needDisable bool) (err error, msg string)

SwitchDirection .

func (*Service) SwitchFlow

func (s *Service) SwitchFlow(c context.Context, id int64, needDisable bool) (err error)

SwitchFlow .

func (*Service) SwitchNet

func (s *Service) SwitchNet(c context.Context, id int64, needDisable bool) (err error)

SwitchNet .

func (*Service) SwitchTransition

func (s *Service) SwitchTransition(c context.Context, id int64, needDisable bool) (err error)

SwitchTransition .

func (*Service) Task

func (s *Service) Task(c context.Context, tid int64) (task *taskmod.Task, err error)

Task 直接读取某个任务

func (*Service) TaskStat

func (s *Service) TaskStat(c context.Context, opt *common.BaseOptions) (stat *taskmod.Stat, err error)

TaskStat task stat

func (*Service) TokenByName

func (s *Service) TokenByName(c context.Context, businessID int64, name string) (result map[string]string, err error)

TokenByName .

func (*Service) TokenGroupByType

func (s *Service) TokenGroupByType(c context.Context, netID int64) (result map[string][]*net.Token, err error)

TokenGroupByType .

func (*Service) TrackResource

func (s *Service) TrackResource(c context.Context, pm *model.TrackParam) (res *model.TrackInfo, p common.Pager, err error)

TrackResource 资源信息追踪, 获取资源add/update日志,并分页,以此为基准,获取对应时间端内的资源audit日志;若add/update日志只有不超过1页,则获取全部audit日志;超过1页,最后一页会返回剩余的全部audit日志

func (*Service) TxAddResource

func (s *Service) TxAddResource(ormTx *gorm.DB, b *resource.Resource, r *resource.Result) (rid int64, err error)

TxAddResource .

func (*Service) TxDelResource

func (s *Service) TxDelResource(c context.Context, ormTx *gorm.DB, bizid int64, rids []int64) (delState int, err error)

TxDelResource .

func (*Service) TxSubmitTask

func (s *Service) TxSubmitTask(c context.Context, ormTx *gorm.DB, opt *common.BaseOptions, state int8) (ostate int8, otaskid, ouid int64, err error)

TxSubmitTask 提交任务

func (*Service) TxUpdateResource

func (s *Service) TxUpdateResource(tx *gorm.DB, rid int64, res map[string]interface{}, rscRes *resource.Result) (err error)

TxUpdateResource .

func (*Service) UnDoStat

func (s *Service) UnDoStat(c context.Context, opt *common.BaseOptions) (stat *taskmod.UnDOStat, err error)

UnDoStat undo stat

func (*Service) Update

func (s *Service) Update(c context.Context, opt *model.UpdateOption) (err error)

Update 业务方修改资源参数

func (*Service) UpdateBizCFG

func (s *Service) UpdateBizCFG(c context.Context, b *business.BizCFG) (err error)

UpdateBizCFG .

func (*Service) UpdateBusiness

func (s *Service) UpdateBusiness(c context.Context, b *business.Business) (err error)

UpdateBusiness .

func (*Service) UpdateConfig

func (s *Service) UpdateConfig(c context.Context, config *task.Config) (err error)

UpdateConfig .

func (*Service) UpdateDirection

func (s *Service) UpdateDirection(c context.Context, uid int64, d *net.DirEditParam) (err error, msg string)

UpdateDirection .

func (*Service) UpdateFlow

func (s *Service) UpdateFlow(c context.Context, uid int64, f *net.FlowEditParam) (err error, msg string)

UpdateFlow .

func (*Service) UpdateNet

func (s *Service) UpdateNet(c context.Context, uid int64, n *net.NetEditParam) (err error, msg string)

UpdateNet .

func (*Service) UpdateTransition

func (s *Service) UpdateTransition(c context.Context, uid int64, f *net.TransitionEditParam) (err error, msg string)

UpdateTransition .

func (*Service) Upload

func (s *Service) Upload(c context.Context, fileName string, fileType string, timing int64, body []byte) (location string, err error)

Upload to bfs

func (*Service) Watcher

func (s *Service) Watcher(c context.Context, bizid, flowid int64, role int8) (watchers []*task.WatchItem, err error)

Watcher 监控管理

func (*Service) WeightLog

func (s *Service) WeightLog(c context.Context, taskid int64, pn, ps int) (ls []*model.WeightLog, count int, err error)

WeightLog .

Jump to

Keyboard shortcuts

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