Documentation ¶
Index ¶
- Variables
- func CancelTimer(timerId int64)
- func Close()
- func Closed() bool
- func CreateTimer(receiver int64, delay int64, msg Msg) int64
- func DumpTimers(buffer *bytes.Buffer) error
- func RegistTimerHander(action Action, handler *TimerHandler)
- func StartTimers(data *bytes.Buffer, excutor taskexcutor.Excutor) func()
- func TimerExist(timerId int64, checkParticle bool) bool
- type Action
- type DBTimer
- type Msg
- type RTimer
- type TimerHandler
- type TimerInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var (
MAX_TIMER_CHAN_SIZE = 0x10000
)
Functions ¶
func CreateTimer ¶
* *创建延时执行定时器 delay 毫秒 返回定时器唯一id 当返回0表示添加失败 * 注意:存档导出只会导出设置了receiver>0标识符的任务 * 其他任务统一当临时任务处理,不做存档
func DumpTimers ¶
* * 数据库定时任务导出 * 注意:只会导出设置了Receiver>0标识符的任务 * 其他任务统一当临时任务处理,不做存档
func RegistTimerHander ¶
func RegistTimerHander(action Action, handler *TimerHandler)
注册定时事件执行函数 handler默认第一个参数将由定时器赋值为 *dbtimer.RTimer
func StartTimers ¶
func StartTimers(data *bytes.Buffer, excutor taskexcutor.Excutor) func()
加载定时器数据,返回开启定时器函数 *注意:需要在服务器时间同步后再调用返回的函数
Types ¶
type DBTimer ¶
type DBTimer struct { Receiver int64 //接受者标识符 Expired int64 // 到期的 UTC时间 毫秒 Id int64 //定时器唯一id Data Msg //存储的数据 }
存档定时器数据 Marshal/unmarshal timers
type Msg ¶
type Msg struct { Action Action //事件数据 需要 gob.Register(Struct{}) Data interface{} }
定时器数据包
type RTimer ¶
type RTimer struct { Receiver int64 //接受者标识符 Msg Msg //存储的数据 //定时任务唯一id TimerId int64 //particleTimer id Ptid int64 // contains filtered or unexported fields }
事件
func GetTimerInfo ¶
type TimerHandler ¶
type TimerHandler struct { ID interface{} // contains filtered or unexported fields }
func NewTimerHandler ¶
func NewTimerHandler(callback taskexcutor.CallBack) *TimerHandler
Click to show internal directories.
Click to hide internal directories.