queue

package
v2.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionQueue

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

ExecutionQueue handles the queues for each different repository it finds.

func GetExecQueue

func GetExecQueue() *ExecutionQueue

GetExecQueue will return the queue singleton.

func (*ExecutionQueue) Add

func (eq *ExecutionQueue) Add(exec Executor)

Add adds an Executor to the queue.

func (*ExecutionQueue) Get

func (eq *ExecutionQueue) Get(repository string) Executor

Get returns and removes and executor from the given repository. If the queue for the repository is empty it will be removed completely.

func (*ExecutionQueue) GetRepositories

func (eq *ExecutionQueue) GetRepositories() []string

GetRepositories returns a list of all repositories that are currently handled by the queue.

func (*ExecutionQueue) IsEmpty

func (eq *ExecutionQueue) IsEmpty(repository string) bool

IsEmpty checks if the queue for the given repository is empty.

type Executor

type Executor interface {
	// Execute triggers the actual job
	Execute() error
	// Exclusive will return true, if the job is an
	// exclusive job and can't be run together with
	// other jobs on the same repository.
	Exclusive() bool
	// Logger returns the logger in the job's context so we can
	// Associate the logs with the actual job.
	Logger() logr.Logger
	// GetJobType returns the type of the CDR that the job will execute
	GetJobType() k8upv1.JobType
	// GetJobNamespace returns the namespace of the CDR that the job will execute
	GetJobNamespace() string
	// GetConcurrencyLimit returns the concurrency limit
	GetConcurrencyLimit() int
	// GetRepository returns the name of the repository
	GetRepository() string
}

Executor defines an interface for the execution queue.

type QueuedJob

type QueuedJob struct {
	Job Executor
	// contains filtered or unexported fields
}

QueuedJob is the priority queue's internal object.

Jump to

Keyboard shortcuts

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