timer

package
v0.0.0-...-7429660 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithValue

func WithValue(value interface{}) func(c *Context)

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

func (*Context) Value

func (c *Context) Value() interface{}

type Option

type Option func(*Options)

func BufSize

func BufSize(size int) Option

func MetricsTags

func MetricsTags(tags ...interface{}) Option

func Precision

func Precision(p time.Duration) Option

func SlotSize

func SlotSize(size int) Option

type Options

type Options struct {
	SlotSize  int
	Precision time.Duration
	BufSize   int
	// contains filtered or unexported fields
}

type TimerId

type TimerId uint64

type TimingWheel

type TimingWheel struct {
	// contains filtered or unexported fields
}

TimingWheel manages all the timed task.

func NewTimingWheel

func NewTimingWheel(ctx context.Context, setters ...Option) *TimingWheel

NewTimingWheel returns a *TimingWheel ready for use.

func (*TimingWheel) AddTimer

func (tw *TimingWheel) AddTimer(after, interval time.Duration, setters ...func(c *Context)) (*Context, error)

AddTimer adds new timed task.

func (*TimingWheel) CancelTimer

func (tw *TimingWheel) CancelTimer(ctx *Context)

func (*TimingWheel) Stop

func (tw *TimingWheel) Stop()

Stop stops the TimingWheel.

func (*TimingWheel) TimeOutChannel

func (tw *TimingWheel) TimeOutChannel() chan *Context

TimeOutChannel returns the timeout channel.

Jump to

Keyboard shortcuts

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