Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrClosed = errors.New("TimingWheel is closed already") ErrArgument = errors.New("incorrect task argument") )
Functions ¶
This section is empty.
Types ¶
type TimingWheel ¶
type TimingWheel struct {
// contains filtered or unexported fields
}
A TimingWheel is a timing wheel object to schedule tasks.
func NewTimingWheel ¶
NewTimingWheel returns a TimingWheel.
func NewTimingWheelWithTicker ¶
func NewTimingWheelWithTicker(interval time.Duration, numSlots int, execute Execute, ticker timex.Ticker) (*TimingWheel, error)
NewTimingWheelWithTicker returns a TimingWheel with the given ticker.
func (*TimingWheel) Drain ¶
func (tw *TimingWheel) Drain(fn func(key, value any)) error
Drain drains all items and executes them.
func (*TimingWheel) MoveTimer ¶
func (tw *TimingWheel) MoveTimer(key any, delay time.Duration) error
MoveTimer moves the task with the given key to the given delay.
func (*TimingWheel) RemoveTimer ¶
func (tw *TimingWheel) RemoveTimer(key any) error
RemoveTimer removes the task with the given key.
func (*TimingWheel) SetTimer ¶
func (tw *TimingWheel) SetTimer(key, value any, delay time.Duration) error
SetTimer sets the task value with the given key to the delay.
func (*TimingWheel) Stop ¶
func (tw *TimingWheel) Stop()
Stop stops tw. No more actions after stopping a TimingWheel.
Click to show internal directories.
Click to hide internal directories.