timer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MININT = time.Second

MININT is the minimal interval for delete to run. In most cases, it is better to be set as 0

Variables

This section is empty.

Functions

This section is empty.

Types

type AggrFunc

type AggrFunc func([]interface{})

type AggrTimer

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

func NewAggrTimer

func NewAggrTimer(chSize int, batchSize int, aggrFunc AggrFunc, quit chan struct{}, wg *sync.WaitGroup) *AggrTimer

func (*AggrTimer) Schedule

func (timer *AggrTimer) Schedule(t AggrTimerTask)

func (*AggrTimer) Start

func (timer *AggrTimer) Start()

type AggrTimerTask

type AggrTimerTask struct {
	ScheduleTime time.Time
	Val          interface{}
}

func NewAggrTimerTask

func NewAggrTimerTask(when time.Time, val interface{}) AggrTimerTask

func (AggrTimerTask) IsEmpty

func (t AggrTimerTask) IsEmpty() bool

func (AggrTimerTask) OK

func (t AggrTimerTask) OK() bool

func (AggrTimerTask) Until

func (t AggrTimerTask) Until() time.Duration

type BasicTimer

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

func NewBasicTimer

func NewBasicTimer(chSize int, quit chan struct{}, wg *sync.WaitGroup) *BasicTimer

func (*BasicTimer) Schedule

func (timer *BasicTimer) Schedule(t *Task)

func (*BasicTimer) Start

func (timer *BasicTimer) Start()

type ConcurrentBasicTimer

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

func NewConcurrentBasicTimer

func NewConcurrentBasicTimer(partitionNumber int, chSizePerPartition int) *ConcurrentBasicTimer

func (*ConcurrentBasicTimer) Close

func (c *ConcurrentBasicTimer) Close()

func (*ConcurrentBasicTimer) Initialize

func (c *ConcurrentBasicTimer) Initialize(partitionNumber int, chSizePerPartition int)

func (*ConcurrentBasicTimer) Schedule

func (c *ConcurrentBasicTimer) Schedule(t *Task)

func (*ConcurrentBasicTimer) Start

func (c *ConcurrentBasicTimer) Start()

type Task

type Task struct {
	ScheduleTime time.Time
	// contains filtered or unexported fields
}

func NewTask

func NewTask(scheduleTime time.Time, f func()) *Task

type TaskQueue

type TaskQueue []*Task

func (TaskQueue) Len

func (h TaskQueue) Len() int

func (TaskQueue) Less

func (h TaskQueue) Less(i, j int) bool

func (*TaskQueue) Pop

func (h *TaskQueue) Pop() interface{}

func (*TaskQueue) Push

func (h *TaskQueue) Push(x interface{})

func (TaskQueue) Swap

func (h TaskQueue) Swap(i, j int)

type Timer

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

func NewTimer

func NewTimer() *Timer

func (*Timer) Close

func (timer *Timer) Close()

func (*Timer) Schedule

func (timer *Timer) Schedule(t *Task)

func (*Timer) Start

func (timer *Timer) Start()

Jump to

Keyboard shortcuts

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