Documentation
¶
Overview ¶
Package timewheel implement a time wheel similar with Netty's HashedTimeWheel
Index ¶
- Constants
- type TaskHandler
- type TimeWheel
- func (tw *TimeWheel) AddTask(delayDurations time.Duration, handler TaskHandler) (string, error)
- func (tw *TimeWheel) BQuit() error
- func (tw *TimeWheel) HandleErr() <-chan error
- func (tw *TimeWheel) Info() (name string, startTime time.Time, capacity int64)
- func (tw *TimeWheel) Quit() error
- func (tw *TimeWheel) Run() error
Constants ¶
View Source
const ( DEFAULT_TIMEWHEEL_SLOTSNUM = 3600 DEFAULT_TIMEWHEEL_STEPDURATION = time.Microsecond DEFAULT_TIMEWHEEL_ERRORSIZE = 1024 )
some default config parameters
View Source
const ( TIMEWHEEL_RUNNING_STATUS_INIT = iota TIMEWHEEL_RUNNING_STATUS_RUNNING TIMEWHEEL_RUNNING_STATUS_END )
timewheel running status
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TimeWheel ¶
type TimeWheel struct {
// contains filtered or unexported fields
}
timewheel entity
func NewTimeWheel ¶
return a new time wheel of given parameters for example: NewTimeWheel("example", 3600, time.Second, 100) will return a TimeWheel which has accuracy of 1 second and running around once an hour(3600 * 1s), it has an err channel to receive task handler's return err,which has 100 capacity.
func (*TimeWheel) BQuit ¶ added in v0.1.1
BQuit will blocking until all task in the timewheel has been finished,then quit
Click to show internal directories.
Click to hide internal directories.