task

package
v0.0.0-...-0677d28 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDummyObject

func GetDummyObject(name string) *metav1.ObjectMeta

GetDummyObject returns a valid object that can be used in the Queue

Types

type Element

type Element struct {
	Key         interface{}
	Timestamp   int64
	IsSkippable bool
}

Element represents one item of the queue

type Queue

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

Queue manages a time work queue through an independent worker that invokes the given sync function for every work item inserted. The queue uses an internal timestamp that allows the removal of certain elements which timestamp is older than the last successful get operation.

func NewCustomTaskQueue

func NewCustomTaskQueue(syncFn func(interface{}) error, fn func(interface{}) (interface{}, error)) *Queue

NewCustomTaskQueue ...

func NewTaskQueue

func NewTaskQueue(syncFn func(interface{}) error) *Queue

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

func (*Queue) EnqueueSkippableTask

func (t *Queue) EnqueueSkippableTask(obj interface{})

EnqueueSkippableTask enqueues ns/name of the given api object in the task queue that can be skipped

func (*Queue) EnqueueTask

func (t *Queue) EnqueueTask(obj interface{})

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

func (*Queue) IsShuttingDown

func (t *Queue) IsShuttingDown() bool

IsShuttingDown returns if the method Shutdown was invoked

func (*Queue) Run

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

Run starts processing elements in the queue

func (*Queue) Shutdown

func (t *Queue) 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