package
0.0.0-20190220103131-045890faf5e6
Repository: https://github.com/go-orion/orion.git
Documentation: pkg.go.dev

# 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

# Functions

NewExecutor builds and returns an executor.
WithConcurrency sets the number of concurrent works.
WithFailOnError fails all task if even a single task returns a error.

# Interfaces

Executor is the interface for a basic executor pipeline.

# Type aliases

Option represents different options available for Executor.
Task is the basic task that gets executed in executor.