# Module dht_node_join

- Description
- Data Types
- Function Index
- Function Details

dht_node join procedure.

Copyright © 2007-2015 Zuse Institute Berlin

Version: $Id$

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

## Description

dht_node join procedure

## Data Types

### connection()

    connection() = {null | pos_integer(), comm:mypid()}

### join_message()

    join_message() =
        {join, start} |
        {get_dht_nodes_response, Nodes :: [node:node_type()]} |
        {join,
         get_number_of_samples,
         Samples :: non_neg_integer(),
         Conn :: connection()} |
        {join,
         get_candidate_response,
         OrigJoinId :: rt_chord:key(),
         Candidate :: lb_op:lb_op(),
         Conn :: connection()} |
        {join,
         join_response,
         Succ :: node:node_type(),
         Pred :: node:node_type(),
         MoveFullId :: slide_op:id(),
         CandId :: lb_op:id(),
         TargetId :: rt_chord:key(),
         NextOp :: slide_op:next_op()} |
        {join,
         join_response,
         not_responsible | busy,
         CandId :: lb_op:id()} |
        {join, known_hosts_timeout, JoinUUId :: pos_integer()} |
        {join,
         lookup_timeout,
         Conn :: connection(),
         JoinId :: rt_chord:key(),
         JoinUUId :: pos_integer()} |
        {join,
         get_number_of_samples_timeout,
         Conn :: connection(),
         JoinUUId :: pos_integer()} |
        {join,
         join_request_timeout,
         Timeouts :: non_neg_integer(),
         CandId :: lb_op:id(),
         JoinUUId :: pos_integer()} |
        {join, timeout, JoinUUId :: pos_integer()} |
        {join,
         number_of_samples_request,
         SourcePid :: comm:mypid(),
         LbPsv :: module(),
         Conn :: connection()} |
        {join,
         get_candidate,
         Source_PID :: comm:mypid(),
         Key :: rt_chord:key(),
         LbPsv :: module(),
         Conn :: connection()} |
        {join,
         join_request,
         NewPred :: node:node_type(),
         CandId :: lb_op:id(),
         MaxTransportEntries :: unknown | pos_integer()} |
        {join,
         LbPsv :: module(),
         Msg ::
             lb_psv_simple:custom_message() |
             lb_psv_split:custom_message() |
             lb_psv_gossip:custom_message(),
         LbPsvState :: term()}

### join_state()

    join_state() =
        {join,
         {phase1,
          JoinUUId :: pos_integer(),
          Options :: [tuple()],
          MyKeyVersion :: non_neg_integer(),
          Connections :: [],
          JoinIds :: [rt_chord:key()],
          Candidates :: []},
         QueuedMessages :: msg_queue:msg_queue()} |
        {join, phase_2_4(), QueuedMessages :: msg_queue:msg_queue()}

### phase2()

    phase2() =
        {phase2,
         JoinUUId :: pos_integer(),
         Options :: [tuple()],
         MyKeyVersion :: non_neg_integer(),
         Connections :: [{null | pos_integer(), comm:mypid()}],
         JoinIds :: [rt_chord:key()],
         Candidates :: [lb_op:lb_op()]}

### phase2b()

    phase2b() =
        {phase2b,
         JoinUUId :: pos_integer(),
         Options :: [tuple()],
         MyKeyVersion :: non_neg_integer(),
         Connections :: [{null | pos_integer(), comm:mypid()}, ...],
         JoinIds :: [rt_chord:key()],
         Candidates :: [lb_op:lb_op()]}

### phase3()

    phase3() =
        {phase3,
         JoinUUId :: pos_integer(),
         Options :: [tuple()],
         MyKeyVersion :: non_neg_integer(),
         Connections :: [{null | pos_integer(), comm:mypid()}],
         JoinIds :: [rt_chord:key()],
         Candidates :: [lb_op:lb_op()]}

### phase4()

    phase4() =
        {phase4,
         JoinUUId :: pos_integer(),
         Options :: [tuple()],
         MyKeyVersion :: non_neg_integer(),
         Connections :: [{null | pos_integer(), comm:mypid()}],
         JoinIds :: [rt_chord:key()],
         Candidates :: [lb_op:lb_op()]}

### phase_2_4()

    phase_2_4() = phase2() | phase2b() | phase3() | phase4()

## Function Index

check_config/0 | Checks whether config parameters of the dht_node process during join exist and are valid.
join_as_first/3 |
join_as_other/3 |
process_join_msg/2 | Process requests from a joining node at a existing node:.
process_join_state/2 | Process a DHT node's join messages during the join phase.
reject_join_response/4 |

## Function Details

### join_as_first/3

    join_as_first(Id :: rt_chord:key(),
                  IdVersion :: non_neg_integer(),
                  Options :: [tuple()]) ->
                     dht_node_state:state()

### join_as_other/3

    join_as_other(Id :: rt_chord:key(),
                  IdVersion :: non_neg_integer(),
                  Options :: [tuple()]) ->
                     {'$gen_component',
                      [{on_handler,
                        Handler :: gen_component:handler()}],
                      State :: {join, phase2(), msg_queue:msg_queue()}}

### process_join_state/2

    process_join_state(Msg :: dht_node:message(),
                       State :: join_state()) ->
                          join_state() |
                          {'$gen_component',
                           [{on_handler,
                             Handler :: gen_component:handler()}],
                           dht_node_state:state()}

Process a DHT node's join messages during the join phase.

### process_join_msg/2

    process_join_msg(Msg :: join_message(),
                     State :: dht_node_state:state()) ->
                        dht_node_state:state()

Process requests from a joining node at a existing node:

### reject_join_response/4

    reject_join_response(Succ :: node:node_type(),
                         Pred :: node:node_type(),
                         MoveFullId :: slide_op:id(),
                         CandId :: lb_op:id()) ->
                            ok

### check_config/0

    check_config() -> boolean()

Checks whether config parameters of the dht_node process during join exist and are valid.

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