queue

package
v0.0.0-...-a44c915 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Closure

type Closure func(v interface{}) error

Closure is the function used for each item in the Queue to handle the logic

type QueueWorker

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

QueueWorker allow us to run N concurrent jobs in order

func New

func New(capacity, workers int) *QueueWorker

New initiates a new FIFO queue

func (*QueueWorker) Push

func (qw *QueueWorker) Push(v interface{}) error

Push item to the queue

func (*QueueWorker) Work

func (qw *QueueWorker) Work(closure Closure) error

Work starts N coroutines based on QueueWorker.workers The queue will stop at first failure if any. The workers expect the queue to be populated before any work is started.

Jump to

Keyboard shortcuts

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