1 Star 0 Fork 0

simplexyz / simplego

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
worker.go 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
李文建 提交于 2023-10-30 15:28 . 完善actor
package define
import (
"time"
sadefine "gitee.com/simplexyz/simplego/actor/define"
satimer "gitee.com/simplexyz/simplego/actor/timer"
sawork "gitee.com/simplexyz/simplego/actor/work"
)
// IWorker 供Super子类调用的接口
type IWorker interface {
PID() *sadefine.PID
Start(ctx sadefine.Context, name string, startFunc func() error, wait bool) (err error)
HasStart() bool
Started() bool
Stop(stopFunc func(), wait bool) error
HasStop() bool
Post(work sawork.IPostWork) error
Dispatch(timeout time.Duration, work sawork.IDispatchWork) error
NewTimer(dur time.Duration, tag satimer.Tag, cb satimer.Callback) satimer.ID
NewLoopTimer(dur time.Duration, tag satimer.Tag, cb satimer.Callback) satimer.ID
StopTimer(id satimer.ID) error
}
// IWorkerImplement 供Worker调用的接口
type IWorkerImplement interface {
Destroy()
OnStarted(ctx sadefine.Context)
OnStopping(ctx sadefine.Context)
OnStopped(ctx sadefine.Context)
OnReceiveMessage(ctx sadefine.Context)
OnActorTerminated(who *sadefine.PID, ctx sadefine.Context)
OnRestarting(ctx sadefine.Context)
OnRestarted(ctx sadefine.Context)
BeforeTriggerTimer(id satimer.ID, tag satimer.Tag, ctx sadefine.Context) (ok bool, err error)
AfterTriggerTimer(err error, id satimer.ID, tag satimer.Tag, ctx sadefine.Context)
}
Go
1
https://gitee.com/simplexyz/simplego.git
git@gitee.com:simplexyz/simplego.git
simplexyz
simplego
simplego
d62e3dcece80

搜索帮助