# Module wpool

- Description
- Data Types
- Function Index
- Function Details

worker pool implementation.

Copyright © 2007-2015 Zuse Institute Berlin

Version: $Id$

Behaviours: `gen_component`.

Authors: Jan Fajerski (`fajerski@zib.de`).

## Description

worker pool implementation. This gen_component handles arbitrary workloads for other processes. It can be send a do_work message with a job specification and will return the results of the computation or an error. Jobs will run concurrently in seperate processes. The maximum number of concurrent workers can be configured via the wpool_maxw setting in scalaris.[local.]config. when the maximum number of jobs is reached new jobs are queued and run as soon as a running job finishes.

## Data Types

### avail_workers()

    avail_workers() = [comm:mypid()]

### job()

    job() = mr_job()

### message()

    message() =
        {do_work, Source :: comm:mypid(), job()} |
        {'DOWN', reference(), process, pid(), Info :: any()} |
        {data, pid(), [tuple()]}

### mr_job()

    mr_job() =
        {mr_state:fun_term(),
         Data :: db_ets:db(),
         Interval :: intervals:interval()}

### state()

    state() = {avail_workers(), working(), waiting_jobs()}

### waiting_jobs()

    waiting_jobs() = [{comm:mypid(), job()}]

### working()

    working() = [{Worker :: comm:mypid(), Source :: comm:mypid()}]

## Function Index

init/1 |
on/2 |
start_gen_component/5 |
start_link/2 |

## Function Details

### start_gen_component/5

    start_gen_component(Module :: module(),
                        Handler :: gen_component:handler(),
                        Args :: term(),
                        Options :: [gen_component:option()],
                        Self :: pid()) ->
                           no_return() | ok

### init/1

    init(X1 :: []) -> state()

### start_link/2

    start_link(DHTNodeGroup :: pid_groups:groupname(),
               Options :: tuple()) ->
                  {ok, pid()}

### on/2

    on(Msg :: message(), State :: state()) -> state()

Generated by EDoc, Apr 22 2017, 15:58:25.