queue

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxRetries int           // Maximum retry attempts (-1 for infinite)
	BaseDelay  time.Duration // Initial retry delay
	MaxDelay   time.Duration // Maximum retry delay
	StatePath  string        // Path to save queue state
}

Config holds queue configuration

type Persistence

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

Persistence handles saving and loading queue state

func NewPersistence

func NewPersistence(statePath string) (*Persistence, error)

NewPersistence creates a new persistence handler

func (*Persistence) Load

func (p *Persistence) Load() ([]*model.Item, error)

Load loads queue items from disk

func (*Persistence) Save

func (p *Persistence) Save(items []*model.Item) error

Save saves queue items to disk

type Queue

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

Queue is a thread-safe FIFO queue with persistence

func NewQueue

func NewQueue(cfg *Config) (*Queue, error)

NewQueue creates a new FIFO queue

func (*Queue) Dequeue

func (q *Queue) Dequeue() *model.Item

Dequeue removes and returns the item from the front of the queue Returns nil if queue is empty or all items are not ready for retry

func (*Queue) Enqueue

func (q *Queue) Enqueue(item *model.Item) error

Enqueue adds an item to the back of the queue

func (*Queue) List

func (q *Queue) List() []*model.Item

List returns all items in the queue

func (*Queue) Load

func (q *Queue) Load() error

Load restores the queue state from disk

func (*Queue) Requeue

func (q *Queue) Requeue(item *model.Item, err error) error

Requeue adds a failed item back to the end of the queue

func (*Queue) Save

func (q *Queue) Save() error

Save persists the queue state to disk

func (*Queue) Size

func (q *Queue) Size() int

Size returns the number of items in the queue

Jump to

Keyboard shortcuts

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