# Module msg_delay

- Description
- Data Types
- Function Index
- Function Details

Cheap message delay.

Copyright © 2009-2015 Zuse Institute Berlin, 2009 onScale solutions GmbH

Version: $Id$

Behaviours: `gen_component`.

Authors: Florian Schintke (`schintke@zib.de`).

## Description

Cheap message delay. Instead of using send_after, which is slow in Erlang, as it performs a system call, this module allows for a weaker message delay. You can specify the minimum message delay in seconds and the component will send the message sometime afterwards. Only local messages inside a VM are supported. Internally it triggers itself periodically to schedule sending.

## Data Types

### message()

    message() =
        {msg_delay_req,
         Seconds :: pos_integer(),
         Dest :: comm:erl_local_pid(),
         Msg :: comm:message(),
         comm:send_local_options()} |
        {msg_delay_periodic}

### state()

    state() =
        {TimeTable :: pdb:tableid(), Round :: non_neg_integer()}

## Function Index

init/1 |
on/2 |
send_local/3 |
send_local/4 |
send_local_as_client/3 |
send_local_as_client/4 |
send_trigger/2 |
start_gen_component/5 |
start_link/1 |

## 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

### send_local_as_client/3

    send_local_as_client(Seconds :: non_neg_integer(),
                         Dest :: comm:erl_local_pid(),
                         Msg :: comm:message()) ->
                            ok

### send_local_as_client/4

    send_local_as_client(Seconds :: non_neg_integer(),
                         Dest :: comm:erl_local_pid(),
                         Msg :: comm:message(),
                         Options :: comm:send_local_options()) ->
                            ok

### send_local/3

    send_local(Seconds :: non_neg_integer(),
               Dest :: comm:erl_local_pid(),
               Msg :: comm:message()) ->
                  ok

### send_local/4

    send_local(Seconds :: non_neg_integer(),
               Dest :: comm:erl_local_pid(),
               Msg :: comm:message(),
               Options :: comm:send_local_options()) ->
                  ok

### start_link/1

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

### send_trigger/2

    send_trigger(Seconds :: non_neg_integer(), Msg :: comm:message()) ->
                    ok

### init/1

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

### on/2

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

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