...

Package queue

import "framework/runtime/queue"
Overview
Index

Overview ▾

type PrioritySchedulingQueue

Implements a priority queue version of the SchedulingQueue. All methods are thread-safe.

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

func NewPrioritySchedulingQueue

func NewPrioritySchedulingQueue(lessFn collections.LessFunc[*pipeline.QueuedPodInfo]) *PrioritySchedulingQueue

func (*PrioritySchedulingQueue) Close

func (pq *PrioritySchedulingQueue) Close()

func (*PrioritySchedulingQueue) Dequeue

func (pq *PrioritySchedulingQueue) Dequeue() *pipeline.QueuedPodInfo

func (*PrioritySchedulingQueue) Enqueue

func (pq *PrioritySchedulingQueue) Enqueue(podInfo *pipeline.QueuedPodInfo)

func (*PrioritySchedulingQueue) IsClosed

func (pq *PrioritySchedulingQueue) IsClosed() bool

func (*PrioritySchedulingQueue) Len

func (pq *PrioritySchedulingQueue) Len() int

type SchedulingQueue

Used to queue incoming pods for the scheduling pipeline.

All method implementations must be thread-safe.

type SchedulingQueue interface {

    // Adds a new pod to the scheduling queue or replaces an existing pod with the same key,
    // if it already exists in the queue.
    //
    // If the queue is closed, this method does nothing.
    Enqueue(podInfo *pipeline.QueuedPodInfo)

    // Dequeues the next pod for scheduling.
    // If no pod is currently waiting, this method will block until there is such a pod or the queue is closed.
    //
    // Returns the next queued pod or nil if the queue has been closed.
    Dequeue() *pipeline.QueuedPodInfo

    // Closes this queue and causes all pending Dequeue() operations to return nil.
    Close()

    // Returns true if the queue is closed.
    IsClosed() bool

    // Returns the number of pods currently in the queue.
    Len() int
}