Documentation ¶
Overview ¶
* 一定要记得在confin.json配置这个模块的参数,否则无法使用
* 一定要记得在confin.json配置这个模块的参数,否则无法使用
Index ¶
- Variables
- type HttpResponse
- type Master
- func (m *Master) GetArgs(req *http.Request) map[string]string
- func (m *Master) GetType() string
- func (m *Master) ModuleList(w http.ResponseWriter, req *http.Request)
- func (m *Master) OnDestroy()
- func (m *Master) OnInit(app module.App, settings *conf.ModuleSettings)
- func (m *Master) ProcessList(w http.ResponseWriter, req *http.Request)
- func (m *Master) ReportForm(moduleType string, ProcessID string, Id string, Version string, ...) (result string, err string)
- func (m *Master) Run(closeSig chan bool)
- func (m *Master) StartProcess(w http.ResponseWriter, req *http.Request)
- func (m *Master) StopProcess(w http.ResponseWriter, req *http.Request)
- func (m *Master) UpdateProcessState(w http.ResponseWriter, req *http.Request)
- func (m *Master) Version() string
- type ModuleReport
- type Timer
Constants ¶
This section is empty.
Variables ¶
View Source
var MasterModule = func() module.Module { master := new(Master) return master }
View Source
var TimerModule = func() module.Module { Timer := new(Timer) return Timer }
Functions ¶
This section is empty.
Types ¶
type HttpResponse ¶
func NewErrorResponse ¶
func NewErrorResponse(Code string, Error string) *HttpResponse
func NewHttpResponse ¶
func NewHttpResponse(Code string, Result interface{}) *HttpResponse
func (*HttpResponse) String ¶
func (h *HttpResponse) String() string
type Master ¶
type Master struct { basemodule.BaseModule ProcessMap map[string]*master.Process ModuleReports map[string]*ModuleReport //moduleID -- ModuleReport // contains filtered or unexported fields }
func (*Master) ModuleList ¶
func (m *Master) ModuleList(w http.ResponseWriter, req *http.Request)
* 获取模块状态
func (*Master) ProcessList ¶
func (m *Master) ProcessList(w http.ResponseWriter, req *http.Request)
* 获取进程状态
func (*Master) ReportForm ¶
func (m *Master) ReportForm(moduleType string, ProcessID string, Id string, Version string, statistics string, Executing int64) (result string, err string)
* 模块汇报
func (*Master) StartProcess ¶
func (m *Master) StartProcess(w http.ResponseWriter, req *http.Request)
* 启动进程
func (*Master) StopProcess ¶
func (m *Master) StopProcess(w http.ResponseWriter, req *http.Request)
* 停止进程
func (*Master) UpdateProcessState ¶
func (m *Master) UpdateProcessState(w http.ResponseWriter, req *http.Request)
* 刷新进程状态
type ModuleReport ¶
type ModuleReport struct { ModuleType string Id string Version string ProcessID string Executing int64 //当前正在执行的函数数量,暂态的,下一次上报时刷新 ReportForm map[string]*basemodule.StatisticalMethod //运行状态报表 }
* 每一个模块的最新汇报信息
type Timer ¶
func (*Timer) Run ¶
func (m *Timer)callback2(args interface{}) { //每次在当前时间点之后5s插入一个定时器,这样就能形成每隔5秒调用一次callback2回调函数,可以用于周期性事件 SetTimer("callback2", 60, m.callback2, time.Now().UnixNano()) log.Debug("time",(time.Now().UnixNano()-args.(int64))/1000000) fmt.Println(time.Now().Format("2006-01-02 15:04:05")) }
Click to show internal directories.
Click to hide internal directories.