# Module cloudi_service_map_reduce

- Description
- Data Types
- Function Index
- Function Details

### CloudI (Abstract) Map-Reduce Service

This module provides an Erlang behaviour for fault-tolerant, database agnostic map-reduce.

Copyright © 2012-2021 Michael Truog

Version: 2.0.3 Dec 3 2021 23:02:34 ------------------------------------------------------------------------

Behaviours: `cloudi_service`.

This module defines the `cloudi_service_map_reduce` behaviour.
Required callback functions: `cloudi_service_map_reduce_new/5`, `cloudi_service_map_reduce_send/2`, `cloudi_service_map_reduce_resend/2`, `cloudi_service_map_reduce_recv/7`, `cloudi_service_map_reduce_info/3`.

Authors: Michael Truog (`mjtruog at protonmail dot com`).

## Description

### CloudI (Abstract) Map-Reduce Service

This module provides an Erlang behaviour for fault-tolerant, database agnostic map-reduce. See the hexpi test for example usage.

## Data Types

### map_send_args()

`map_send_args() = nonempty_list()`

## Function Index

aspect_resume/1 | #### Function for aspects_resume service configuration option. Add as {cloudi_service_map_reduce, aspect_resume}.
aspect_suspend/1 | #### Function for aspects_suspend service configuration option. Add as {cloudi_service_map_reduce, aspect_suspend}.
cloudi_service_handle_info/3 |
cloudi_service_init/4 |
cloudi_service_terminate/3 |
elapsed_seconds/0 | #### Get the current elapsed seconds in a Map-Reduce callback function. .

## Function Details

### aspect_resume/1

`aspect_resume(State::#state{service = pid(), map_reduce_module = module(), map_reduce_state = any(), map_reduce_name = string(), map_count = pos_integer(), log_execution_time = boolean(), retry = non_neg_integer(), retry_delay = non_neg_integer(), timeout_max = cloudi_service:timeout_value_milliseconds(), map_requests = #{cloudi_service:trans_id() := #map_send{send_args = map_send_args(), retry_count = non_neg_integer()}}, time_running = cloudi_timestamp:seconds_monotonic(), suspended = boolean(), elapsed_seconds = non_neg_integer()}) -> {ok, #state{service = pid(), map_reduce_module = module(), map_reduce_state = any(), map_reduce_name = string(), map_count = pos_integer(), log_execution_time = boolean(), retry = non_neg_integer(), retry_delay = non_neg_integer(), timeout_max = cloudi_service:timeout_value_milliseconds(), map_requests = #{cloudi_service:trans_id() := #map_send{send_args = map_send_args(), retry_count = non_neg_integer()}}, time_running = cloudi_timestamp:seconds_monotonic(), suspended = boolean(), elapsed_seconds = non_neg_integer()}}`

#### Function for aspects_resume service configuration option.

Add as {cloudi_service_map_reduce, aspect_resume}.

### aspect_suspend/1

`aspect_suspend(State::#state{service = pid(), map_reduce_module = module(), map_reduce_state = any(), map_reduce_name = string(), map_count = pos_integer(), log_execution_time = boolean(), retry = non_neg_integer(), retry_delay = non_neg_integer(), timeout_max = cloudi_service:timeout_value_milliseconds(), map_requests = #{cloudi_service:trans_id() := #map_send{send_args = map_send_args(), retry_count = non_neg_integer()}}, time_running = cloudi_timestamp:seconds_monotonic(), suspended = boolean(), elapsed_seconds = non_neg_integer()}) -> {ok, #state{service = pid(), map_reduce_module = module(), map_reduce_state = any(), map_reduce_name = string(), map_count = pos_integer(), log_execution_time = boolean(), retry = non_neg_integer(), retry_delay = non_neg_integer(), timeout_max = cloudi_service:timeout_value_milliseconds(), map_requests = #{cloudi_service:trans_id() := #map_send{send_args = map_send_args(), retry_count = non_neg_integer()}}, time_running = cloudi_timestamp:seconds_monotonic(), suspended = boolean(), elapsed_seconds = non_neg_integer()}}`

#### Function for aspects_suspend service configuration option.

Add as {cloudi_service_map_reduce, aspect_suspend}.

### cloudi_service_handle_info/3

`cloudi_service_handle_info(Init_begin, Init_state, Dispatcher) -> any()`

### cloudi_service_init/4

`cloudi_service_init(Args, Prefix, Timeout, Dispatcher) -> any()`

### cloudi_service_terminate/3

`cloudi_service_terminate(Reason, Timeout, State) -> any()`

### elapsed_seconds/0

`elapsed_seconds() -> cloudi_service_api:seconds()`

#### Get the current elapsed seconds in a Map-Reduce callback function.

Generated by EDoc