dbtimer

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MAX_TIMER_CHAN_SIZE = 0x10000
)

Functions

func CancelTimer

func CancelTimer(timerId int64)

关闭指定id的定时事件

func Close

func Close()

func Closed

func Closed() bool

func CreateTimer

func CreateTimer(receiver int64, delay int64, msg Msg) int64

* *创建延时执行定时器 delay 毫秒 返回定时器唯一id 当返回0表示添加失败 * 注意:存档导出只会导出设置了receiver>0标识符的任务 * 其他任务统一当临时任务处理,不做存档

func DumpTimers

func DumpTimers(buffer *bytes.Buffer) error

* * 数据库定时任务导出 * 注意:只会导出设置了Receiver>0标识符的任务 * 其他任务统一当临时任务处理,不做存档

func RegistTimerHander

func RegistTimerHander(action Action, handler *TimerHandler)

注册定时事件执行函数 handler默认第一个参数将由定时器赋值为 *dbtimer.RTimer

func StartTimers

func StartTimers(data *bytes.Buffer, excutor taskexcutor.Excutor) func()

加载定时器数据,返回开启定时器函数 *注意:需要在服务器时间同步后再调用返回的函数

func TimerExist

func TimerExist(timerId int64, checkParticle bool) bool

指定定时事件是否存在

Types

type Action

type Action int32

消息执行事件

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

func GetTimerInfo(timerId int64) *RTimer

type TimerHandler

type TimerHandler struct {
	ID interface{}
	// contains filtered or unexported fields
}

func NewTimerHandler

func NewTimerHandler(callback taskexcutor.CallBack) *TimerHandler

type TimerInfo

type TimerInfo struct {
	Timers []DBTimer
	NextId int64
}

Jump to

Keyboard shortcuts

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