# Module mr_state

- Description
- Data Types
- Function Index
- Function Details

state for one map reduce node.

Copyright © 2012 Zuse Institute Berlin

Version: $Id$

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

## Description

state for one map reduce node

## Data Types

### client_key()

    client_key() = [unicode_char()]

### data()

    data() = data_list() | data_ets()

### data_ets()

    data_ets() = db_ets:db()

### data_list()

    data_list() = [{rt_chord:key(), string(), term()}]

data in ets table has the same format

### delta_phase()

    delta_phase() =
        {PhaseNr :: pos_integer(),
         fun_term(),
         Input :: data_list(),
         ToWorkOn :: intervals:interval(),
         WorkingOn :: intervals:interval()}

### erl_fun()

    erl_fun() =
        {map,
         erlanon,
         fun((Arg :: {client_key(), term()}) ->
                 Res :: [{client_key(), term()}])} |
        {reduce,
         erlanon,
         fun((Arg :: [{client_key(), term()}]) ->
                 Res :: [{client_key(), term()}])}

### ets_phase()

    ets_phase() =
        {PhaseNr :: pos_integer(),
         fun_term(),
         Input :: data_ets(),
         ToWorkOn :: intervals:interval(),
         WorkingOn :: intervals:interval()}

### fun_term()

    fun_term() = erl_fun() | js_fun()

### job_description()

    job_description() = {[fun_term(), ...], [option()]}

### jobid()

    jobid() = [0..255, ...]

### js_fun()

    js_fun() = {map | reduce, jsanon, binary()}

### option()

    option() = {tag, atom()}

### phase()

    phase() = ets_phase() | delta_phase()

### state()

    state() =
        #state{jobid = jobid(),
               client = comm:mypid() | false,
               master_id = rt_chord:key(),
               phases = [phase(), ...],
               options = [option()],
               acked = intervals:interval()}

### unicode_char()

    unicode_char() = 0..55295 | 57344..65533 | 65536..1114111

## Function Index

accumulate_data/2 |
add_data_to_phase/4 |
clean_up/1 |
get/2 |
get_phase/2 |
get_slide_delta/2 |
init_slide_state/1 |
interval_empty/3 |
interval_processed/3 |
interval_processing/3 |
is_acked_complete/1 |
is_last_phase/2 |
merge_states/2 |
new/6 |
reset_acked/1 |
set_acked/2 |
tester_create_valid_funterm/2 |
tester_is_valid_funterm/1 |

## Function Details

### get/2

    get(State :: state(), Key :: client) -> comm:mypid() | false

### new/6

    new(JobId :: jobid(),
        Client :: comm:mypid(),
        Master :: rt_chord:key(),
        InitalData :: data_list(),
        X5 :: job_description(),
        Interval :: intervals:interval()) ->
           state()

### is_last_phase/2

    is_last_phase(State :: state(), Round :: pos_integer()) ->
                     boolean()

### get_phase/2

    get_phase(State :: state(), Round :: pos_integer()) ->
                 phase() | false

### is_acked_complete/1

    is_acked_complete(State :: state()) -> boolean()

### reset_acked/1

    reset_acked(State :: state()) -> state()

### set_acked/2

    set_acked(State :: state(), NewInterval :: intervals:interval()) ->
                 state()

### interval_processing/3

    interval_processing(State :: state(),
                        Interval :: intervals:interval(),
                        Round :: pos_integer()) ->
                           state()

### interval_processed/3

    interval_processed(State :: state(),
                       Interval :: intervals:interval(),
                       Round :: pos_integer()) ->
                          state()

### interval_empty/3

    interval_empty(State :: state(),
                   Interval :: intervals:interval(),
                   Round :: pos_integer()) ->
                      state()

### add_data_to_phase/4

    add_data_to_phase(State :: state(),
                      NewData :: data_list(),
                      Interval :: intervals:interval(),
                      Round :: pos_integer()) ->
                         state()

### accumulate_data/2

    accumulate_data(Data :: [{client_key(), term()}], List :: data()) ->
                       data()

### clean_up/1

    clean_up(State :: state()) -> [true]

### get_slide_delta/2

    get_slide_delta(State :: state(),
                    SlideInterval :: intervals:interval()) ->
                       {state(), state()}

### init_slide_state/1

    init_slide_state(State :: state()) -> state()

### merge_states/2

    merge_states(State :: state(), X2 :: state()) -> state()

### tester_is_valid_funterm/1

    tester_is_valid_funterm(X1 :: fun_term()) -> boolean()

### tester_create_valid_funterm/2

    tester_create_valid_funterm(X1 :: erlanon | jsanon,
                                MoR :: map | reduce) ->
                                   fun_term()

Generated by EDoc, Feb 29 2016, 16:12:20.