blocker

package
v0.6.26-beta.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: GPL-3.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 Blocker

type Blocker interface {
	Pop() *types.ClaimableWallet
	Next()
}

func NewBlocker

func NewBlocker() Blocker

type Job

type Job struct {
	Name   string
	Action func() error // A function that should be executed when the job is running.
}

Job - holds fmtic to perform some operations during queue execution.

func (Job) Run

func (j Job) Run() error

Run performs job execution.

type Queue

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

Queue holds name, list of jobs and context with cancel.

func NewQueue

func NewQueue(name string) *Queue

NewQueue instantiates new queue.

func (*Queue) AddJob

func (q *Queue) AddJob(job Job)

AddJob sends job to the channel.

func (*Queue) AddJobs

func (q *Queue) AddJobs(jobs []Job)

AddJobs adds jobs to the queue and cancels channel.

func (*Queue) PendingJobs

func (q *Queue) PendingJobs() int

PendingJobs returns number of pending jobs.

type Worker

type Worker struct {
	Queue *Queue
}

Worker responsible for queue serving.

func NewWorker

func NewWorker(queue *Queue) *Worker

NewWorker initializes a new Worker.

func (*Worker) DoWork

func (w *Worker) DoWork(errCh chan error) bool

DoWork processes jobs from the queue (jobs channel).

Jump to

Keyboard shortcuts

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