workerpool

package module
v0.0.0-...-0c74836 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2018 License: GPL-3.0 Imports: 3 Imported by: 0

README

go-lang Worker Pool

Go-Lang package implementing the worker pool pattern

Introduction

This worker pool package implementation was inspired by the publication about understanding its mechanics, fundamentals and actual design.

Requirements

Documentation

Overview

Package workerpool implements the design pattern for worker pool

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

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

Job Structure that wraps Jobs information

type Pool

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

Manager generic struct that keeps all the logic to manage the queues

func NewPool

func NewPool(numRoutines int) *Pool

NewManager returns a new manager structure ready to be used.

func (*Pool) IsCompleted

func (m *Pool) IsCompleted() bool

IsCompleted utility method to check if all work has done from an outside caller.

func (*Pool) Start

func (m *Pool) Start(resources []interface{}, procFunc ProcessorFunc, resFunc ResultProcessorFunc)

type ProcessorFunc

type ProcessorFunc func(resource interface{}) error

ProcessorFunc signature that defines the dependency injection to process "Jobs"

type Result

type Result struct {
	Job Job
	Err error
}

Result holds the main structure for worker processed job results.

type ResultProcessorFunc

type ResultProcessorFunc func(result Result) error

ResultProcessorFunc signature that defines the dependency injection to process "Results"

Jump to

Keyboard shortcuts

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