scheduler

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package scheduler contains a priority queue based on time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scheduler

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

A Scheduler implements a priority queue based on time. The scheduler is not thread-safe for multiple writers.

func New

func New() *Scheduler

New creates a new Scheduler.

func (*Scheduler) Add

func (s *Scheduler) Add(due time.Time, key string)

Add adds an item to the scheduler.

func (*Scheduler) Next

func (s *Scheduler) Next() (time.Time, string)

Next retrieves the next time an item is due.

func (*Scheduler) Remove

func (s *Scheduler) Remove(key string)

Remove removes an item from the scheduler and de-schedules it.

Jump to

Keyboard shortcuts

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