interfaces

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 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 AsyncWork

type AsyncWork interface {
	// Start starts the worker channel
	Start() error

	// Stop stops all running and scheduled jobs
	Stop() error

	// PostJob schedules a job execution
	PostJob(job JobFn) error

	// PostJob schedules a job execution and tags with "tag"
	PostTaggedJob(job JobFn, tag string) error

	// PostThrottledJob posts a job only and only if the time span of its last execution was greater than "duration"
	PostThrottledJob(job JobFn, delay time.Duration) error

	// PostTaggedThrottledJob same as PostThrottled but check only with jobs with the same tag
	PostTaggedThrottledJob(job JobFn, tag string, delay time.Duration) error

	// Len returns the number of jobs scheduled
	Len() int

	// ErrorChan registers an error emitting channel
	ErrorChan(ch chan error)
}

AsyncWork provides a scheduling work channel

type JobFn

type JobFn func(ctx context.Context) error

JobFn job interface

Jump to

Keyboard shortcuts

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