taskqueue

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package taskqueue contains task queue

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskQueue

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

TaskQueue manages a work queue through an independent worker that invokes the given sync function for every work item inserted.

func NewTaskQueue

func NewTaskQueue(syncFn func(string, interface{}) error) *TaskQueue

NewTaskQueue creates a new task queue with the given sync function. The sync function is called for every element inserted into the queue.

func (*TaskQueue) Enqueue

func (tq *TaskQueue) Enqueue(name string, data interface{})

Enqueue enqueues ns/name of the given api object in the task queue.

func (*TaskQueue) Len

func (tq *TaskQueue) Len() int

Len returns the length of the queue.

func (*TaskQueue) Requeue

func (tq *TaskQueue) Requeue(task task, err error)

Requeue adds the task to the queue again and logs the given error.

func (*TaskQueue) RequeueAfter

func (tq *TaskQueue) RequeueAfter(t task, err error, after time.Duration)

RequeueAfter adds the task to the queue after the given duration.

func (*TaskQueue) Run

func (tq *TaskQueue) Run(period time.Duration, stopCh <-chan struct{})

Run begins running the worker for the given duration.

func (*TaskQueue) Shutdown

func (tq *TaskQueue) Shutdown()

Shutdown shuts down the work queue and waits for the worker to ACK.

Jump to

Keyboard shortcuts

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