Documentation ¶
Overview ¶
Package tik implements Hierarchical Timing Wheels.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultConfig is the default Ticker Config. DefaultConfig = Config{ WheelBitNum: 6, WheelNum: 4, Timer: nil, } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // number of value bits mapped in each wheel. WheelBitNum uint8 // number of wheels. WheelNum uint8 // Timer to progress the timing wheel. Timer Timer }
Config used to init Ticker.
type DefaultTimer ¶
type DefaultTimer struct {
// contains filtered or unexported fields
}
DefaultTimer implements Timer interface.
func (*DefaultTimer) Now ¶
func (dt *DefaultTimer) Now() uint64
Now returns the absolute time when timer started in millisecond.
func (*DefaultTimer) Step ¶
func (dt *DefaultTimer) Step() <-chan uint64
Step timing wheel by absolute time in millisecond.
type Ticker ¶
type Ticker struct {
// contains filtered or unexported fields
}
Ticker progress the timing wheels.
func (*Ticker) AnyExpired ¶
AnyExpired returns true if expiry queue is not empty, false otherwise.
func (*Ticker) AnyPending ¶
AnyPending returns true if there is task in wheels, false otherwise.
func (*Ticker) Close ¶
func (tk *Ticker) Close()
Close stop processing any task, whether it is pending or expired.
type Timeout ¶
type Timeout struct {
// contains filtered or unexported fields
}
Timeout represents user timeout logic.
Click to show internal directories.
Click to hide internal directories.