# Module rt_loop

- Description
- Data Types
- Function Index
- Function Details

routing table process.

Copyright © 2007-2015 Zuse Institute Berlin

Version: $Id$

Behaviours: `gen_component`.

Authors: Thorsten Schuett (`schuett@zib.de`).

## Description

routing table process

## Data Types

### message()

    message() =
        {trigger_rt} |
        {periodic_rt_rebuild} |
        {update_rt,
         OldNeighbors :: nodelist:neighborhood(),
         NewNeighbors :: nodelist:neighborhood()} |
        {fd_notify,
         fd:event(),
         DeadPid :: comm:mypid(),
         Reason :: fd:reason()} |
        {web_debug_info, Requestor :: comm:erl_local_pid()} |
        {dump, Pid :: comm:erl_local_pid()} |
        rt_chord:custom_message()

### state_active()

abstract datatype: `state_active()`

### state_inactive()

    state_inactive() =
        {inactive, MessageQueue :: msg_queue:msg_queue()}

userdevguide-end rt_loop:state

## Function Index

activate/1 | Activates the routing table process.
check_config/0 | Checks whether config parameters of the rt_loop process exist and are valid.
deactivate/0 | Deactivates the re-register process.
get_ert/1 |
get_neighb/1 |
get_pid_dht/1 |
get_rt/1 |
init/1 | Initialises the module with an empty state.
on_active/2 | Message handler when the module is fully initialized.
on_inactive/2 | Message handler during start up phase (will change to on_active/2 when a 'activate_rt' message is received).
rm_neighbor_change/3 | Filter function for subscriptions that returns true if a any neighbor changes.
rm_send_update/5 | Notifies the node's routing table of a changed neighborhood.
set_ert/2 |
set_rt/2 |
start_gen_component/5 |
start_link/1 | Starts the routing tabe maintenance process, registers it with the process dictionary and returns its pid for use by a supervisor.

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

### activate/1

    activate(Neighbors :: nodelist:neighborhood()) -> ok

Activates the routing table process. If not activated, it will queue most messages without processing them. Pre: dht_node must be up and running

### deactivate/0

    deactivate() -> ok

Deactivates the re-register process.

### start_link/1

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

Starts the routing tabe maintenance process, registers it with the process dictionary and returns its pid for use by a supervisor.

### init/1

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

Initialises the module with an empty state.

### on_inactive/2

    on_inactive(Msg :: message(), State :: state_inactive()) ->
                   state_inactive()

Message handler during start up phase (will change to on_active/2 when a 'activate_rt' message is received).

### on_active/2

    on_active(Message :: message(), State :: state_active()) ->
                 state_active() |
                 {'$gen_component',
                  [{post_op, Msg :: {periodic_rt_rebuild}}, ...],
                  state_active()} |
                 unknown_event

Message handler when the module is fully initialized.

### get_neighb/1

    get_neighb(State :: state_active()) -> nodelist:neighborhood()

### get_pid_dht/1

    get_pid_dht(State :: state_active()) -> comm:mypid()

### get_rt/1

    get_rt(State :: state_active()) -> rt_chord:rt()

### set_rt/2

    set_rt(State :: state_active(), RT :: rt_chord:rt()) ->
              NewState :: state_active()

### get_ert/1

    get_ert(State :: state_active()) -> rt_chord:external_rt()

### set_ert/2

    set_ert(State :: state_active(), ERT :: rt_chord:external_rt()) ->
               NewState :: state_active()

### rm_neighbor_change/3

    rm_neighbor_change(OldNeighbors :: nodelist:neighborhood(),
                       NewNeighbors :: nodelist:neighborhood(),
                       Reason :: rm_loop:reason()) ->
                          boolean()

Filter function for subscriptions that returns true if a any neighbor changes.

### rm_send_update/5

    rm_send_update(Subscriber :: pid(),
                   Tag :: rt_loop,
                   OldNeighbors :: nodelist:neighborhood(),
                   NewNeighbors :: nodelist:neighborhood(),
                   Reason :: rm_loop:reason()) ->
                      ok

Notifies the node's routing table of a changed neighborhood. Used to subscribe to the ring maintenance.

### check_config/0

    check_config() -> boolean()

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

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