eq_queue

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecWithQueue

func ExecWithQueue(f func(q Definition))

Types

type Container

type Container interface {
	// Get queue for queueId
	Get(queueId string) (q Queue, found bool)

	// Get queue for queueId. Panic when a queue is not found for the id.
	MustGet(queueId string) Queue

	// Wait for complete all queues
	Wait()

	// Suspend queue. Workers will be shutdown, but do not wait for worker shutdown.
	Suspend() (session eq_bundle.Session, err error)
}

type Definition

type Definition interface {
	// Define a queue
	Define(queueId string, f interface{}, ctx ...interface{})

	// Traverse
	Each(f func(queueId string, f interface{}, ctx []interface{}))

	// Create a new container
	Current() Container

	// Restore container from the session
	Restore(session eq_bundle.Session) (Container, error)

	// Add error handler listener
	AddErrorListener(h ErrorListener)
}

func New

func New(opt ...Opt) Definition

type ErrorListener

type ErrorListener eq_mould.ErrorListener

type Opt

type Opt func(o Opts) Opts

func AddErrorListener

func AddErrorListener(eh eq_mould.ErrorListener) Opt

func Factory

func Factory(f eq_pipe.Factory) Opt

func FetchPolicy

func FetchPolicy(p eq_bundle.FetchPolicy) Opt

func Logger

func Logger(l esl.Logger) Opt

func NumWorker

func NumWorker(n int) Opt

func Progress

func Progress(p eq_progress.Progress) Opt

func Verbose

func Verbose(enabled bool) Opt

type Opts

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

func (Opts) Apply

func (z Opts) Apply(opts ...Opt) Opts

type Queue

type Queue interface {
	// Enqueue data into the queue.
	Enqueue(p interface{})

	// Create sub queue with batchId
	Batch(batchId string) Queue
}

Jump to

Keyboard shortcuts

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