async_task

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorHandler

type ErrorHandler func(error)

It is executed if error is raised

type Keeper

type Keeper interface {
	AddTask(ctx context.Context, task Task) error
}

External interface

func NewAsyncTask

func NewAsyncTask(opts ...Option) (Keeper, error)

Create a object of the Keeper

type Option

type Option interface {
	// contains filtered or unexported methods
}

type OptionFunc

type OptionFunc func(k *keeper)

func WithErrorHandlerOption

func WithErrorHandlerOption(f ErrorHandler) OptionFunc

func WithQueueSizeOption

func WithQueueSizeOption(size int) OptionFunc

func WithTimeoutOption

func WithTimeoutOption(timeout time.Duration) OptionFunc

func WithWorkerSizeOption

func WithWorkerSizeOption(size int) OptionFunc

type Task

type Task interface {
	Process(ctx context.Context) error
}

It is the task to dealt with

Jump to

Keyboard shortcuts

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