executor

package
v0.0.0-...-045890f Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: Apache-2.0 Imports: 2 Imported by: 1

README

executor

import "github.com/go-orion/Orion/utils/executor"

Overview

Imported Packages

No packages beyond the Go standard library are imported.

Index

Package files

executor.go types.go

type Executor

type Executor interface {
    //Add adds a task to executor queue
    Add(task Task)
    //Wait waits for all executors to finish or one of them to error based on option selected
    Wait() error
}

Executor is the interface for a basic executor pipeline

func NewExecutor
func NewExecutor(options ...Option) Executor

NewExecutor builds and returns an executor

type Option

type Option func(*config)

Option represents different options available for Executor

func WithConcurrency
func WithConcurrency(n int) Option

WithConcurrency sets the number of concurrent works

func WithFailOnError
func WithFailOnError(fail bool) Option

WithFailOnError fails all task if even a single task returns a error

type Task

type Task func() error

Task is the basic task that gets executed in executor


Generated by godoc2ghmd

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	//Add adds a task to executor queue
	Add(task Task)
	//Wait waits for all executors to finish or one of them to error based on option selected
	Wait() error
}

Executor is the interface for a basic executor pipeline

func NewExecutor

func NewExecutor(options ...Option) Executor

NewExecutor builds and returns an executor

type Option

type Option func(*config)

Option represents different options available for Executor

func WithConcurrency

func WithConcurrency(n int) Option

WithConcurrency sets the number of concurrent works

func WithFailOnError

func WithFailOnError(fail bool) Option

WithFailOnError fails all task if even a single task returns a error

type Task

type Task func() error

Task is the basic task that gets executed in executor

Jump to

Keyboard shortcuts

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