queue

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Ingress resource
	Ingress = iota
	// IngressMinion resource, which is a Minion Ingress resource
	IngressMinion
	// Endpoints resource
	Endpoints
	// ConfigMap resource
	ConfigMap
	// Secret resource
	Secret
	// Service resource
	Service
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int

Kind represents the kind of the Kubernetes resources of a task

type Task

type Task struct {
	Kind Kind
	Key  string
}

Task is an element of a TaskQueue

func NewTask

func NewTask(key string, obj interface{}) (Task, error)

NewTask creates a new task

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(Task)) *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 (t *TaskQueue) Enqueue(obj interface{})

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

func (*TaskQueue) Requeue

func (t *TaskQueue) Requeue(task Task, err error)

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

func (*TaskQueue) RequeueAfter

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

RequeueAfter adds the task to the queue after the given duration

func (*TaskQueue) Run

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

Run begins running the worker for the given duration

func (*TaskQueue) Shutdown

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