# Module slide_op

- Description
- Data Types
- Function Index
- Function Details

Slide operation structure for node moves, joins and leaves.

Copyright © 2010-2014 Zuse Institute Berlin

Version: $Id$

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

## Description

Slide operation structure for node moves, joins and leaves.

## Data Types

### erlang_timestamp()

    erlang_timestamp() =
        {MegaSecs :: non_neg_integer(),
         Secs :: 0..999999,
         MicroSecs :: 0..999999}

### id()

    id() = uid:global_uid()

### next_op()

    next_op() =
        {slide, continue, Id :: rt_chord:key()} |
        {jump, continue, Id :: rt_chord:key()} |
        {leave, continue} |
        {slide,
         pred | succ,
         Id :: rt_chord:key(),
         Tag :: any(),
         SourcePid :: comm:mypid() | null} |
        {jump,
         Id :: rt_chord:key(),
         Tag :: any(),
         SourcePid :: comm:mypid() | null} |
        {leave, SourcePid :: comm:mypid() | null} |
        {none}

### phase()

    phase() = phase_plain() | {wait_for_continue, phase_plain()}

async (local) slide message to rm-specific implementation

### phase_plain()

    phase_plain() =
        null |
        wait_for_other |
        wait_for_data_ack |
        wait_for_delta_ack |
        wait_for_data |
        wait_for_delta

### slide_op()

abstract datatype: `slide_op()`

### type()

    type() =
        {slide, pred | succ, send | rcv} |
        {join, send | rcv} |
        {leave, send | rcv} |
        {jump, send | rcv}

## Function Index

get_id/1 | Returns the id of a receiving or sending slide operation.
get_interval/1 | Returns the interval of data to receive or send.
get_jump_target_id/1 |
get_msg_fwd/1 |
get_my_old_id/1 | Returns the old ID before any changes, i.e.
get_next_op/1 |
get_node/1 | Returns the node to exchange data with.
get_other_max_entries/1 |
get_phase/1 | Returns the current phase of the slide operation.
get_predORsucc/1 | Returns whether the given slide operation works with the successor or predecessor.
get_sendORreceive/1 | Returns whether the given slide operation sends or receives data.
get_send_errors/1 | Returns the number of send errors from messages with shepherd.
get_source_pid/1 | Gets the pid of the (local) process that requested the move or null if no local process initiated it.
get_tag/1 | Returns the tag of a slide operation.
get_target_id/1 | Returns the target id a node participating in a receiving or sending slide operation moves to (note: this may be the other node).
get_time_last_send/1 | Returns the time of the last send operation.
get_time_next_warn/1 | Returns the time the next warning should be emitted if no further send operation occurs.
get_type/1 | Returns the given slide operation's (full) type.
inc_send_errors/1 | Increases the number of send_errors from messages with shepherd by 1.
is_incremental/1 | Returns whether the given slide op is part of an incremental slide.
is_join/1 | Returns whether the given slide op or type is a join operation.
is_join/2 | Returns whether the given slide op or type is a join operation sending or receiving data as provided.
is_jump/1 | Returns whether the given slide op or type is a jump operation.
is_jump/2 | Returns whether the given slide op or type is a jump operation sending or receiving data as provided.
is_leave/1 | Returns whether the given slide op or type is a leave operation.
is_leave/2 | Returns whether the given slide op or type is a leave operation sending or receiving data as provided.
is_setup_at_other/1 | Returns wether the current slide op has already been set up at the other node.
is_slide/1 | Returns whether the given term is a slide op or not.
new_receiving_slide_join/5 | Sets up a new slide operation for a joining node (see dht_node_join.erl).
new_sending_slide_join/4 | Sets up a new slide operation for a node which sends a joining node some of its data.
new_sending_slide_join_i/5 | Sets up an incremental slide operation of the given type.
new_sending_slide_jump/6 | Sets up a new slide operation for a node which is about to leave its position in the ring, transfer its data to its successor incrementally (current step is to move to CurTargetId) and afterwards join somewhere else.
new_sending_slide_leave/5 | Sets up a new slide operation for a node which is about to leave its position in the ring incrementally (current step is to move to CurTargetId) and transfer its data to its successor.
new_slide/8 | Sets up a slide operation of the given type.
new_slide_i/8 | Sets up an incremental slide operation of the given type.
other_type_to_my_type/1 | Converts the given slide type to the type the other participating node can use.
remove_msg_fwd/1 |
reset_send_errors/1 | Resets the number of send_errors from messages with shepherd to 0.
set_msg_fwd/1 |
set_next_op/2 |
set_other_max_entries/2 |
set_phase/2 | Sets the slide operation's current phase.
set_setup_at_other/1 | Sets that the current slide op has already been set up at the other node.
set_time_last_send/2 | Sets the time of the last send operation.
set_time_next_warn/2 | Sets the time the next warning should be emitted if no further send operation occurs.
update_target_id/4 | Updates the slide op with a new TargetId and NextOp adapting message forwards and intervals accordingly.

## Function Details

### new_slide/8

    new_slide(MoveId :: uid:global_uid(),
              Type :: type(),
              CurTargetId :: rt_chord:key(),
              Tag :: any(),
              SourcePid :: comm:mypid() | null,
              OtherMTE :: unknown | pos_integer(),
              NextOp :: next_op(),
              Neighbors :: nodelist:neighborhood()) ->
                 slide_op()

Sets up a slide operation of the given type. One of the nodes will change its ID to TargetId.

### new_slide_i/8

    new_slide_i(MoveId :: uid:global_uid(),
                Type :: type(),
                CurTargetId :: rt_chord:key(),
                FinalTargetId :: rt_chord:key(),
                Tag :: any(),
                SourcePid :: comm:erl_local_pid() | null,
                OtherMTE :: unknown | pos_integer(),
                Neighbors :: nodelist:neighborhood()) ->
                   slide_op()

Sets up an incremental slide operation of the given type. One of the nodes will change its ID to CurTargetId and finally FinalTargetId.

### new_receiving_slide_join/5

    new_receiving_slide_join(MoveId :: uid:global_uid(),
                             TargetId :: rt_chord:key(),
                             Tag :: any(),
                             SourcePid :: comm:mypid(),
                             Neighbors :: nodelist:neighborhood()) ->
                                slide_op()

Sets up a new slide operation for a joining node (see dht_node_join.erl). MyKey is the joining node's new Id and will be used as the target id of the slide operation.

### new_sending_slide_join/4

    new_sending_slide_join(MoveId :: uid:global_uid(),
                           JoiningNode :: node:node_type(),
                           Tag :: any(),
                           Neighbors :: nodelist:neighborhood()) ->
                              slide_op()

Sets up a new slide operation for a node which sends a joining node some of its data. Throws 'throw:not_responsible' if the current node is not responsible for the ID of JoiningNode.

### new_sending_slide_join_i/5

    new_sending_slide_join_i(MoveId :: uid:global_uid(),
                             JoiningNode :: node:node_type(),
                             CurTargetId :: rt_chord:key(),
                             Tag :: any(),
                             Neighbors :: nodelist:neighborhood()) ->
                                slide_op()

Sets up an incremental slide operation of the given type. One of the nodes will change its ID to CurTargetId and finally FinalTargetId.

### new_sending_slide_leave/5

    new_sending_slide_leave(MoveId :: id(),
                            CurTargetId :: rt_chord:key(),
                            Tag :: any(),
                            SourcePid :: comm:erl_local_pid() | null,
                            Neighbors :: nodelist:neighborhood()) ->
                               slide_op()

Sets up a new slide operation for a node which is about to leave its position in the ring incrementally (current step is to move to CurTargetId) and transfer its data to its successor.

### new_sending_slide_jump/6

    new_sending_slide_jump(MoveId :: id(),
                           CurTargetId :: rt_chord:key(),
                           JumpTargetId :: rt_chord:key(),
                           SourcePid :: comm:erl_local_pid(),
                           Tag :: any(),
                           Neighbors :: nodelist:neighborhood()) ->
                              slide_op()

Sets up a new slide operation for a node which is about to leave its position in the ring, transfer its data to its successor incrementally (current step is to move to CurTargetId) and afterwards join somewhere else.

### update_target_id/4

    update_target_id(SlideOp :: slide_op(),
                     TargetId :: rt_chord:key(),
                     NextOp :: next_op(),
                     Neighbors :: nodelist:neighborhood()) ->
                        slide_op()

Updates the slide op with a new TargetId and NextOp adapting message forwards and intervals accordingly.

### get_id/1

    get_id(SlideOp :: slide_op()) -> id()

Returns the id of a receiving or sending slide operation.

### get_node/1

    get_node(SlideOp :: slide_op()) -> node:node_type()

Returns the node to exchange data with.

### get_interval/1

    get_interval(SlideOp :: slide_op()) -> intervals:interval()

Returns the interval of data to receive or send.

### get_my_old_id/1

    get_my_old_id(SlideOp :: slide_op()) -> rt_chord:key() | null

Returns the old ID before any changes, i.e. at the start of the slide (null in case of receiving joins).

### get_target_id/1

    get_target_id(SlideOp :: slide_op()) -> rt_chord:key()

Returns the target id a node participating in a receiving or sending slide operation moves to (note: this may be the other node).

### get_jump_target_id/1

    get_jump_target_id(SlideOp :: slide_op()) -> rt_chord:key()

### get_source_pid/1

    get_source_pid(SlideOp :: slide_op()) ->
                      comm:erl_local_pid() | null

Gets the pid of the (local) process that requested the move or null if no local process initiated it.

### get_tag/1

    get_tag(SlideOp :: slide_op()) -> any()

Returns the tag of a slide operation. This will be send to the originating process (along with the result message).

See also: get_source_pid/1.

### get_sendORreceive/1

    get_sendORreceive(SlideOp :: slide_op() | type()) -> send | rcv

Returns whether the given slide operation sends or receives data.

### get_predORsucc/1

    get_predORsucc(SlideOp :: slide_op() | type()) -> pred | succ

Returns whether the given slide operation works with the successor or predecessor.

### get_type/1

    get_type(SlideOp :: slide_op()) -> type()

Returns the given slide operation's (full) type.

### other_type_to_my_type/1

    other_type_to_my_type(X1 :: type()) -> type()

Converts the given slide type to the type the other participating node can use.

### is_slide/1

    is_slide(Slide_op :: any()) -> boolean()

Returns whether the given term is a slide op or not.

### is_join/1

    is_join(SlideOp :: slide_op() | type()) -> boolean()

Returns whether the given slide op or type is a join operation.

### is_join/2

    is_join(SlideOp :: slide_op() | type(),
            SendOrReceive :: send | rcv) ->
               boolean()

Returns whether the given slide op or type is a join operation sending or receiving data as provided.

### is_leave/1

    is_leave(SlideOp :: slide_op() | type()) -> boolean()

Returns whether the given slide op or type is a leave operation.

### is_leave/2

    is_leave(SlideOp :: slide_op() | type(),
             SendOrReceive :: send | rcv) ->
                boolean()

Returns whether the given slide op or type is a leave operation sending or receiving data as provided.

### is_jump/1

    is_jump(SlideOp :: slide_op() | type()) -> boolean()

Returns whether the given slide op or type is a jump operation.

### is_jump/2

    is_jump(SlideOp :: slide_op() | type(),
            SendOrReceive :: send | rcv) ->
               boolean()

Returns whether the given slide op or type is a jump operation sending or receiving data as provided.

### is_incremental/1

    is_incremental(SlideOp :: slide_op()) -> boolean()

Returns whether the given slide op is part of an incremental slide.

### get_time_last_send/1

    get_time_last_send(SlideOp :: slide_op()) ->
                          erlang_timestamp() | never

Returns the time of the last send operation.

### get_time_next_warn/1

    get_time_next_warn(SlideOp :: slide_op()) ->
                          erlang_timestamp() | never

Returns the time the next warning should be emitted if no further send operation occurs.

### set_time_last_send/2

    set_time_last_send(SlideOp :: slide_op(), X :: erlang_timestamp()) ->
                          slide_op()

Sets the time of the last send operation.

### set_time_next_warn/2

    set_time_next_warn(SlideOp :: slide_op(), X :: erlang_timestamp()) ->
                          slide_op()

Sets the time the next warning should be emitted if no further send operation occurs.

### get_send_errors/1

    get_send_errors(SlideOp :: slide_op()) -> non_neg_integer()

Returns the number of send errors from messages with shepherd.

### inc_send_errors/1

    inc_send_errors(SlideOp :: slide_op()) -> slide_op()

Increases the number of send_errors from messages with shepherd by 1.

### reset_send_errors/1

    reset_send_errors(SlideOp :: slide_op()) -> slide_op()

Resets the number of send_errors from messages with shepherd to 0.

### get_phase/1

    get_phase(SlideOp :: slide_op()) -> phase()

Returns the current phase of the slide operation.

### set_phase/2

    set_phase(SlideOp :: slide_op(), NewPhase :: phase()) ->
                 slide_op()

Sets the slide operation's current phase.

### is_setup_at_other/1

    is_setup_at_other(SlideOp :: slide_op()) -> boolean()

Returns wether the current slide op has already been set up at the other node.

### set_setup_at_other/1

    set_setup_at_other(SlideOp :: slide_op()) -> slide_op()

Sets that the current slide op has already been set up at the other node.

### get_next_op/1

    get_next_op(SlideOp :: slide_op()) -> next_op()

### set_next_op/2

    set_next_op(SlideOp :: slide_op(), NextOp :: next_op()) ->
                   slide_op()

### get_other_max_entries/1

    get_other_max_entries(SlideOp :: slide_op()) ->
                             unknown | pos_integer()

### set_other_max_entries/2

    set_other_max_entries(SlideOp :: slide_op(),
                          OtherMTE :: pos_integer()) ->
                             slide_op()

### get_msg_fwd/1

    get_msg_fwd(SlideOp :: slide_op() | null) ->
                   [{intervals:interval(), comm:mypid()}]

### set_msg_fwd/1

    set_msg_fwd(SlideOp :: slide_op()) -> slide_op()

### remove_msg_fwd/1

    remove_msg_fwd(SlideOp :: slide_op()) -> slide_op()

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