Documentation
¶
Index ¶
Constants ¶
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) EmptyQueue ¶
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 ¶
GetQueueSize returns the current number of items in the queue
func (*QueueData) GetQueueStats ¶
GetQueueStats returns basic statistics about the queue
type QueuedContainerProfile ¶
type QueuedContainerProfile struct {
Profile *v1beta1.ContainerProfile `json:"profile"`
ContainerID string `json:"containerID"`
}
QueuedContainerProfile represents a container profile queued for creation