queue

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package queue provides asynchronous task execution interfaces and implementations.

Index

Constants

This section is empty.

Variables

View Source
var ErrQueueFull = errors.New("queue is full")

ErrQueueFull is returned when the queue cannot accept more tasks.

Functions

This section is empty.

Types

type AntsQueue

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

AntsQueue is an in-memory queue implementation using ants pool.

func NewAntsQueue

func NewAntsQueue(size int) (*AntsQueue, error)

NewAntsQueue creates a new AntsQueue with the given pool size.

func (*AntsQueue) Close

func (q *AntsQueue) Close()

Close releases the pool resources.

func (*AntsQueue) Submit

func (q *AntsQueue) Submit(task func()) error

Submit adds a task to the queue. Returns ErrQueueFull if the queue is full.

type Queue

type Queue interface {
	Submit(task func()) error
	Close()
}

Queue defines the interface for asynchronous task execution.

Jump to

Keyboard shortcuts

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