# Module dht_node_move

- Description
- Data Types
- Function Index
- Function Details

dht_node move procedure Note: assumes that the neighborhood does not change during the handling of a message.

Copyright © 2010-2013 Zuse Institute Berlin

Version: $Id$

Authors: Nico Kruber (`kruber@zib.de`).

## Description

dht_node move procedure Note: assumes that the neighborhood does not change during the handling of a message.

## Data Types

### abort_reason()

    abort_reason() =
        ongoing_slide |
        target_id_not_in_range |
        wrong_pred_succ_node |
        changed_parameters |
        {wrong_interval,
         MyRange :: intervals:interval(),
         MovingDataInterval :: intervals:interval()} |
        existing_data |
        target_down |
        scheduled_leave |
        leave_no_partner_found |
        next_op_mismatch |
        {protocol_error, term()}

### command()

    command() =
        {abort, abort_reason(), OrigType :: slide_op:type()} |
        {ok, NewType :: slide_op:type() | move_done}

### move_message()

    move_message() =
        move_message1() |
        {move,
         {fd_notify,
          fd:event(),
          DeadPid :: comm:mypid(),
          Reason :: fd:reason()}} |
        {move, check_for_timeouts} |
        {move,
         {send_error,
          Target :: comm:mypid(),
          Message :: move_message1(),
          Reason :: atom()},
         {timeouts, Timeouts :: non_neg_integer()}} |
        {move,
         {send_error,
          Target :: comm:mypid(),
          Message :: move_message1(),
          Reason :: atom()},
         MoveFullId :: slide_op:id()}

### move_message1()

    move_message1() =
        {move,
         start_slide,
         pred | succ,
         TargetId :: rt_chord:key(),
         Tag :: any(),
         SourcePid :: comm:mypid() | null} |
        {move,
         start_jump,
         TargetId :: rt_chord:key(),
         Tag :: any(),
         SourcePid :: comm:mypid() | null} |
        {move,
         slide,
         OtherType :: slide_op:type(),
         MoveFullId :: slide_op:id(),
         InitNode :: node:node_type(),
         TargetNode :: node:node_type(),
         TargetId :: rt_chord:key(),
         Tag :: any(),
         NextOp :: slide_op:next_op(),
         MaxTransportEntries :: unknown | pos_integer()} |
        {move,
         slide_abort,
         pred | succ,
         MoveFullId :: slide_op:id(),
         Reason :: abort_reason()} |
        {move,
         data,
         MovingData :: dht_node_state:slide_data(),
         MoveFullId :: slide_op:id(),
         TargetId :: rt_chord:key(),
         NextOp :: slide_op:next_op()} |
        {move, data_ack, MoveFullId :: slide_op:id()} |
        {move,
         delta,
         ChangedData :: dht_node_state:slide_delta(),
         MoveFullId :: slide_op:id()} |
        {move, delta_ack, MoveFullId :: slide_op:id(), next_op_msg()} |
        {move, rm_db_range, MoveFullId :: slide_op:id()} |
        {move, done, MoveFullId :: slide_op:id()} |
        {move,
         continue,
         MoveFullId :: slide_op:id(),
         Operation ::
             prepare_send_data2 |
             update_rcv_data2 |
             prepare_send_delta2 |
             finish_delta2 |
             {finish_delta_ack2, NextOpMsg :: next_op_msg()},
         EmbeddedMsg :: comm:message()}

### next_op_msg()

    next_op_msg() =
        {none} |
        {continue, NewSlideId :: slide_op:id()} |
        {abort, NewSlideId :: slide_op:id(), abort_reason()}

### result_message()

    result_message() =
        {move, result, Tag :: any(), Reason :: abort_reason() | ok}

## Function Index

check_config/0 | Checks whether config parameters regarding dht_node moves exist and are valid.
check_setup_slide_not_found/5 | Checks whether a new slide operation with the node's successor or predecessor and the given parameters can be set up.
exec_setup_slide_not_found/11 | Creates a new slide operation with the node's successor or predecessor and the given parameters according to the command created by check_setup_slide_not_found/5.
get_max_transport_entries/0 | Gets the max number of DB entries per data move operation (set in the config files).
make_jump/4 | Creates a slide with the node's predecessor.
make_slide/5 | Creates a slide with the node's successor or predecessor.
make_slide_leave/2 | Creates a slide that will move all data to the successor and leave the ring.
notify_source_pid/2 | Sends the source pid the given message if it is not 'null'.
process_move_msg/2 | Processes move messages for the dht_node and implements the node move protocol.
send/3 | Sends a move message using the dht_node as the shepherd to handle broken connections.
send_no_slide/3 | Sends a move message using the dht_node as the shepherd to handle broken connections.
send_trigger/0 |
use_incremental_slides/0 | Checks whether incremental slides are to be used (set in the config files).

## Function Details

### send_trigger/0

    send_trigger() -> ok

### process_move_msg/2

    process_move_msg(Msg :: move_message(),
                     State :: dht_node_state:state()) ->
                        dht_node_state:state()

Processes move messages for the dht_node and implements the node move protocol.

### send/3

    send(Pid :: comm:mypid(),
         Message :: comm:message(),
         MoveFullId :: slide_op:id()) ->
            ok

Sends a move message using the dht_node as the shepherd to handle broken connections.

### send_no_slide/3

    send_no_slide(Pid :: comm:mypid(),
                  Message :: comm:message(),
                  Timeouts :: non_neg_integer()) ->
                     ok

Sends a move message using the dht_node as the shepherd to handle broken connections. This does not require a slide_op being set up. The error message handler can count the number of timeouts using the provided cookie.

### check_setup_slide_not_found/5

    check_setup_slide_not_found(State :: dht_node_state:state(),
                                Type :: slide_op:type(),
                                MyNode :: node:node_type(),
                                TargetNode :: node:node_type(),
                                TargetId :: rt_chord:key()) ->
                                   Command :: command()

Checks whether a new slide operation with the node's successor or predecessor and the given parameters can be set up.

### exec_setup_slide_not_found/11

    exec_setup_slide_not_found(Command :: command(),
                               State :: dht_node_state:state(),
                               MoveFullId :: slide_op:id(),
                               TargetNode :: node:node_type(),
                               TargetId :: rt_chord:key(),
                               Tag :: any(),
                               OtherMaxTransportEntries ::
                                   unknown | pos_integer(),
                               SourcePid :: comm:mypid() | null,
                               MsgTag :: nomsg | slide | delta_ack,
                               NextOp :: slide_op:next_op(),
                               FdSubscribed :: boolean()) ->
                                  dht_node_state:state()

Creates a new slide operation with the node's successor or predecessor and the given parameters according to the command created by check_setup_slide_not_found/5. Note: assumes that such a slide does not already exist if command is not abort.

### notify_source_pid/2

    notify_source_pid(SourcePid :: comm:mypid() | null,
                      Message :: result_message()) ->
                         ok

Sends the source pid the given message if it is not 'null'.

### make_slide/5

    make_slide(State :: dht_node_state:state(),
               PredOrSucc :: pred | succ,
               TargetId :: rt_chord:key(),
               Tag :: any(),
               SourcePid :: comm:mypid() | null) ->
                  dht_node_state:state()

Creates a slide with the node's successor or predecessor. TargetId will become the ID between the two nodes, i.e. either the current node or the other node will change its ID to TargetId. SourcePid will be notified about the result.

### make_jump/4

    make_jump(State :: dht_node_state:state(),
              TargetId :: rt_chord:key(),
              Tag :: any(),
              SourcePid :: comm:mypid() | null) ->
                 dht_node_state:state()

Creates a slide with the node's predecessor. The predecessor will change its ID to TargetId, SourcePid will be notified about the result.

### make_slide_leave/2

    make_slide_leave(State :: dht_node_state:state(),
                     SourcePid :: comm:mypid() | null) ->
                        dht_node_state:state()

Creates a slide that will move all data to the successor and leave the ring. Note: Will re-try (forever) to successfully start a leaving slide if anything causes an abort!

### check_config/0

    check_config() -> boolean()

Checks whether config parameters regarding dht_node moves exist and are valid.

### get_max_transport_entries/0

    get_max_transport_entries() -> pos_integer()

Gets the max number of DB entries per data move operation (set in the config files).

### use_incremental_slides/0

    use_incremental_slides() -> boolean()

Checks whether incremental slides are to be used (set in the config files).

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