scheduler

package
v0.0.0-...-5756e46 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessFunc

type ProcessFunc[T comparable] func(T)

ProcessFunc is a function to process an item in the work queue.

type ScheduledWorkQueue

type ScheduledWorkQueue[T comparable] interface {
	// Add will add an item to this queue, executing the ProcessFunc after the
	// Duration has come (since the time Add was called). If an existing Timer
	// for obj already exists, the previous timer will be cancelled.
	Add(T, time.Duration)

	// Forget will cancel the timer for the given object, if the timer exists.
	Forget(T)
}

ScheduledWorkQueue is an interface to describe a queue that will execute the given ProcessFunc with the object given to Add once the time.Duration is up, since the time of calling Add.

func NewScheduledWorkQueue

func NewScheduledWorkQueue[T comparable](clock clock.Clock, processFunc ProcessFunc[T]) ScheduledWorkQueue[T]

NewScheduledWorkQueue will create a new workqueue with the given processFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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