# Module gossip_vivaldi

- Description
- Data Types
- Function Index
- Function Details

Gossip based calculation of Vivaldi coordinates.

Copyright © 2008-2014 Zuse Institute Berlin

Version: $Id$

Behaviours: `gossip_beh`.

Authors: Thorsten Schuett (`schuett@zib.de`), Jens V. Fischer (`jensvfischer@gmail.com`).

## Description

Gossip based calculation of Vivaldi coordinates.

## Data Types

### data()

    data() = any()

### est_error()

    est_error() = float()

### latency()

    latency() = number()

### network_coordinate()

    network_coordinate() = [float()]

### round()

    round() = non_neg_integer()

### state()

    state() = {network_coordinate(), est_error()}

## Function Index

check_config/0 | Checks whether config parameters of the vivaldi process exist and are valid.
fanout/0 | The fanout (number of peers contacted per cycle).
get_coordinate/0 | Sends a (local) message with a vivaldi get_coordinate request to the gossip module of the requesting process' group asking for the current coordinate and confidence.
handle_msg/2 | Handle messages Response from vivaldi_latency after finishing measuring.
init/1 | Initiate the gossip_vivaldi module.
integrate_data/3 | Ignored, vivaldi is a push-only scheme.
max_cycles_per_round/0 | The maximum number of cycles per round.
min_cycles_per_round/0 | The minimum number of cycles per round.
notify_change/3 | Ignored, vivaldi doesn't use / implements these features.
round_has_converged/1 | Always returns false, vivaldi does not implement rounds.
select_data/1 | Select and prepare the data to be sent to the peer.
select_node/1 | Returns false, i.e.
select_reply_data/4 | Process the data from the requestor.
shutdown/1 | Shut down the gossip_vivaldi module.
trigger_interval/0 | The time interval in ms after which a new cycle is triggered by the gossip module.
update_coordinate/5 |
web_debug_info/1 | Returns a key-value list of debug infos for the Web Interface.

## Function Details

### trigger_interval/0

    trigger_interval() -> pos_integer()

The time interval in ms after which a new cycle is triggered by the gossip module.

### fanout/0

    fanout() -> pos_integer()

The fanout (number of peers contacted per cycle).

### min_cycles_per_round/0

    min_cycles_per_round() -> infinity

The minimum number of cycles per round. Returns infinity, as rounds are not implemented by vivaldi.

### max_cycles_per_round/0

    max_cycles_per_round() -> infinity

The maximum number of cycles per round. Returns infinity, as rounds are not implemented by vivaldi.

### check_config/0

    check_config() -> boolean()

Checks whether config parameters of the vivaldi process exist and are valid.

### get_coordinate/0

    get_coordinate() -> ok

Sends a (local) message with a vivaldi get_coordinate request to the gossip module of the requesting process' group asking for the current coordinate and confidence.

### init/1

    init(Args :: [any()]) -> {ok, state()}

Initiate the gossip_vivaldi module.
Called by the gossip module upon startup.
The Instance information is ignored, {gossip_vivaldi, default} is always used.

### select_node/1

    select_node(State :: state()) -> {false, state()}

Returns false, i.e. peer selection is done by the gossip module.

### select_data/1

    select_data(State :: state()) -> {ok, state()}

Select and prepare the data to be sent to the peer.
The data consists of the coordinates and confidence of this node. Called by the gossip module at the beginning of every cycle.
The selected exchange data is to be sent back to the gossip module as a message of the form {selected_data, Instance, ExchangeData}.

### select_reply_data/4

    select_reply_data(PData :: data(),
                      Ref :: pos_integer(),
                      Round :: round(),
                      State :: state()) ->
                         {discard_msg | ok | retry | send_back,
                          state()}

Process the data from the requestor.
No reply-data is selected and no select_reply_data_response is sent to the gossip module, because vivaldi implements a push-only scheme.
Called by the behaviour module upon a p2p_exch message.
PData: exchange data from the p2p_exch request
Ref: used by the gossip module to identify the request
Round: ignored, as vivaldi does not implement round handling

### integrate_data/3

    integrate_data(QData :: data(),
                   Round :: round(),
                   State :: state()) ->
                      {discard_msg | ok | retry | send_back, state()}

Ignored, vivaldi is a push-only scheme.

### handle_msg/2

    handle_msg(Msg :: comm:message(), State :: state()) ->
                  {ok, state()}

Handle messages Response from vivaldi_latency after finishing measuring.

### round_has_converged/1

    round_has_converged(State :: state()) -> {boolean(), state()}

Always returns false, vivaldi does not implement rounds.

### notify_change/3

    notify_change(X1 :: term(), X2 :: term(), State :: state()) ->
                     {ok, state()}

Ignored, vivaldi doesn't use / implements these features.

### web_debug_info/1

    web_debug_info(State :: state()) ->
                      {KeyValueList ::
                           [{Key :: string(), Value :: any()}, ...],
                       state()}

Returns a key-value list of debug infos for the Web Interface.
Called by the gossip module upon {web_debug_info} messages.

### shutdown/1

    shutdown(State :: state()) -> {ok, shutdown}

Shut down the gossip_vivaldi module.
Called by the gossip module upon stop_gossip_task(CBModule).

### update_coordinate/5

    update_coordinate(Coordinate :: network_coordinate(),
                      RemoteError :: est_error(),
                      Latency :: latency(),
                      X4 :: network_coordinate(),
                      Error :: est_error()) ->
                         {network_coordinate(), est_error()}

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