queue

package
v0.2.397 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultQueueName is the default name for the queue.
	DefaultQueueName = "container-profiles-queue"
	// DefaultRetryInterval is the default interval between retries for processing a queue item.
	DefaultRetryInterval = 5 * time.Second
	// DefaultQueueDir is the default directory for the queue.
	DefaultQueueDir = "/profiles"
	// ItemsPerSegment is the number of items per segment in the queue.
	ItemsPerSegment = 100
	// DefaultMaxQueueSize is the default maximum size of the queue
	DefaultMaxQueueSize = 1000
)

Variables

This section is empty.

Functions

func QueuedContainerProfileBuilder

func QueuedContainerProfileBuilder() interface{}

QueuedContainerProfileBuilder creates a new QueuedContainerProfile instance for dque

Types

type ErrorCallback

type ErrorCallback interface {
	OnQueueError(profile *v1beta1.ContainerProfile, containerID string, err error)
}

ErrorCallback defines the interface for handling queue processing errors

type ProfileCreator

type ProfileCreator interface {
	CreateContainerProfileDirect(profile *v1beta1.ContainerProfile) error
}

ProfileCreator defines the interface for creating container profiles

type QueueConfig

type QueueConfig struct {
	QueueName       string
	QueueDir        string
	MaxQueueSize    int
	RetryInterval   time.Duration
	ItemsPerSegment int
	ErrorCallback   ErrorCallback
}

QueueConfig holds configuration for the queue

type QueueData

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

QueueData holds the data and configuration for the queue processing.

func NewQueueData

func NewQueueData(ctx context.Context, creator ProfileCreator, config QueueConfig) (*QueueData, error)

NewQueueData creates a new QueueData instance with simple LRU behavior

func (*QueueData) Close

func (qd *QueueData) Close() error

Close gracefully shuts down the queue

func (*QueueData) EmptyQueue

func (qd *QueueData) EmptyQueue() error

EmptyQueue clears all items from the queue

func (*QueueData) Enqueue

func (qd *QueueData) Enqueue(profile *v1beta1.ContainerProfile, containerID string) error

Enqueue adds a new container profile to the queue with LRU eviction

func (*QueueData) GetQueueSize

func (qd *QueueData) GetQueueSize() int

GetQueueSize returns the current number of items in the queue

func (*QueueData) GetQueueStats

func (qd *QueueData) GetQueueStats() map[string]interface{}

GetQueueStats returns basic statistics about the queue

func (*QueueData) Start

func (qd *QueueData) Start()

Start begins processing the queue

type QueuedContainerProfile

type QueuedContainerProfile struct {
	Profile     *v1beta1.ContainerProfile `json:"profile"`
	ContainerID string                    `json:"containerID"`
}

QueuedContainerProfile represents a container profile queued for creation

Jump to

Keyboard shortcuts

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