Module dht_node_state

State of a dht_node.

Copyright © 2007-2015 Zuse Institute Berlin

Version: $Id$

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

Description

State of a dht_node.

Data Types

db_selector()

db_selector() = kv_db
              | {tx_id, pos_integer()}
              | {lease_db, pos_integer()}

name()

name() = rt
       | rt_size
       | neighbors
       | succlist
       | succ
       | succ_id
       | succ_pid
       | predlist
       | pred
       | pred_id
       | pred_pid
       | node
       | node_id
       | my_range
       | db_range
       | succ_range
       | join_time
       | db
       | tx_tp_db
       | load
       | slide_pred
       | slide_succ
       | msg_fwd
       | rm_state
       | prbr_state

slide_data()

slide_data() = 
    {{MovingData :: db_dht:db_as_list(), slide_snap()},
     [{db_selector(), db_prbr:db_as_list()}]}

slide_delta()

slide_delta() = 
    {{ChangedData :: db_dht:db_as_list(),
      DeletedKeys :: [rt_chord:key()]},
     [{db_selector(),
       {Changed :: db_prbr:db_as_list(),
        Deleted :: [rt_chord:key()]}}],
     {MRDelta :: orddict:orddict(),
      MRMasterDelta :: orddict:orddict()}}

slide_snap()

slide_snap() = {snapshot_state:snapshot_state(),
                db_dht:db_as_list()}
             | {false}

state()

abstract datatype: state()

userdevguide-end dht_node_state:state

Function Index

add_db_range/3
delete_for_rejoin/1Clean up tables before rejoining with a new state.
delete_mr_master_state/2
delete_mr_state/2
details/1Gets the following details about the current node: predecessor and successor lists, the node itself, its load, hostname, routing table size, memory usage.
details/2Gets the requested details about the current node.
dump/1
get/2Gets the given property from the dht_node state.
get_mr_master_state/2
get_mr_state/2
get_slide/2Tries to find a slide operation with the given MoveFullId and returns it including its type (pred or succ) if successful and its pred/succ info is correct.
get_split_key/5Returns a key so that there are no more than TargetLoad entries between Begin and this key in the DBs.
has_left/1Checks whether the current node has already left the ring, i.e.
is_db_responsible/2Checks whether the node is responsible for the given key either by its current range or for a range the node is temporarily responsible for during a slide operation, i.e.
is_db_responsible__no_msg_fwd_check/2Checks whether the node is responsible for the given key either by its current range or for a range the node is temporarily responsible for during a slide operation, i.e.
new/3
new_on_recover/6
rm_db_range/2
set_db/2
set_lease_list/2
set_mr_master_state/3
set_mr_state/3
set_prbr_state/3
set_rm/2
set_rt/2
set_slide/3
set_snapshot_state/2
set_tx_tp_db/2
slide_add_data/2Adds data from slide_get_data_start_record/2 to the local DB.
slide_add_delta/2Adds delta infos from slide_take_delta_stop_record/2 to the local DB.
slide_get_data_start_record/2Gets all entries to transfer (slide) in the given range and starts delta recording on the DB for changes in this interval.
slide_stop_record/3Stops recording changes in the given interval.
slide_take_delta_stop_record/2Gets all DB changes in the given interval, stops recording delta infos and removes the entries in this range from the DB.

Function Details

new/3

new(RT :: rt_chord:external_rt(),
    RMState :: rm_loop:state(),
    DB :: db_dht:db()) ->
       state()

new_on_recover/6

new_on_recover(RT :: rt_chord:external_rt(),
               RMState :: rm_loop:state(),
               PRBR_KV_DB :: prbr:state(),
               TXID_DBs :: [prbr:state()],
               Lease_DBs :: [prbr:state()],
               LeaseList :: lease_list:lease_list()) ->
                  state()

delete_for_rejoin/1

delete_for_rejoin(State :: state()) -> ok

Clean up tables before rejoining with a new state.

get/2

get(State :: state(), Key :: rt) -> rt_chord:external_rt()

Gets the given property from the dht_node state. Allowed keys include:

Beware of race conditions since the neighborhood may have changed at the next call.

set_prbr_state/3

set_prbr_state(State :: state(),
               WhichDB :: db_selector(),
               Value :: prbr:state()) ->
                  state()

set_lease_list/2

set_lease_list(State :: state(),
               LeaseList :: lease_list:lease_list()) ->
                  state()

has_left/1

has_left(State :: state()) -> boolean()

Checks whether the current node has already left the ring, i.e. the has already changed his ID in order to leave or jump.

is_db_responsible/2

is_db_responsible(Key :: intervals:key(), State :: state()) ->
                     boolean()

Checks whether the node is responsible for the given key either by its current range or for a range the node is temporarily responsible for during a slide operation, i.e. we temporarily read/modify data a neighbor is responsible for but hasn't yet received the data from us.

is_db_responsible__no_msg_fwd_check/2

is_db_responsible__no_msg_fwd_check(Key :: intervals:key(),
                                    State :: state()) ->
                                       boolean()

Checks whether the node is responsible for the given key either by its current range or for a range the node is temporarily responsible for during a slide operation, i.e. we temporarily read/modify data a neighbor is responsible for but hasn't yet received the data from us.

get_slide/2

get_slide(State :: state(), MoveFullId :: slide_op:id()) ->
             {Type :: pred | succ, SlideOp :: slide_op:slide_op()} |
             not_found

Tries to find a slide operation with the given MoveFullId and returns it including its type (pred or succ) if successful and its pred/succ info is correct. Otherwise returns {fail, wrong_pred} if the predecessor info is wrong (slide with pred) and {fail, wrong_succ} if the successor info is wrong (slide with succ). If not found, {fail, not_found} is returned.

set_tx_tp_db/2

set_tx_tp_db(State :: state(), NewTxTpDb :: any()) -> state()

set_db/2

set_db(State :: state(), NewDB :: db_dht:db()) -> state()

set_rt/2

set_rt(State :: state(), NewRT :: rt_chord:external_rt()) ->
          state()

set_rm/2

set_rm(State :: state(), NewRMState :: rm_loop:state()) -> state()

set_slide/3

set_slide(State :: state(),
          X2 :: pred | succ,
          SlidePred :: slide_op:slide_op() | null) ->
             state()

set_snapshot_state/2

set_snapshot_state(State :: state(),
                   NewInfo :: snapshot_state:snapshot_state()) ->
                      state()

get_mr_state/2

get_mr_state(State :: state(), JobId :: mr_state:jobid()) ->
                {value, mr_state:state()} | error

set_mr_state/3

set_mr_state(State :: state(),
             JobId :: nonempty_string(),
             MRState :: mr_state:state()) ->
                state()

delete_mr_state/2

delete_mr_state(State :: state(), JobId :: nonempty_string()) ->
                   state()

get_mr_master_state/2

get_mr_master_state(State :: state(), JobId :: mr_state:jobid()) ->
                       mr_master_state:state()

set_mr_master_state/3

set_mr_master_state(State :: state(),
                    JobId :: nonempty_string(),
                    MRMState :: mr_master_state:state()) ->
                       state()

delete_mr_master_state/2

delete_mr_master_state(State :: state(),
                       JobId :: nonempty_string()) ->
                          state()

add_db_range/3

add_db_range(State :: state(),
             Interval :: intervals:interval(),
             SlideId :: slide_op:id()) ->
                state()

rm_db_range/2

rm_db_range(State :: state(), SlideId :: slide_op:id()) -> state()

dump/1

dump(State :: state()) -> ok

details/2

details(State :: state(),
        Which :: [node_details:node_details_name()]) ->
           node_details:node_details()

Gets the requested details about the current node.

details/1

details(State :: state()) -> node_details:node_details()

Gets the following details about the current node: predecessor and successor lists, the node itself, its load, hostname, routing table size, memory usage.

slide_get_data_start_record/2

slide_get_data_start_record(State :: state(),
                            MovingInterval :: intervals:interval()) ->
                               {state(), slide_data()}

Gets all entries to transfer (slide) in the given range and starts delta recording on the DB for changes in this interval.

slide_add_data/2

slide_add_data(State :: state(), X2 :: slide_data()) -> state()

Adds data from slide_get_data_start_record/2 to the local DB.

slide_take_delta_stop_record/2

slide_take_delta_stop_record(State :: state(),
                             MovingInterval ::
                                 intervals:interval()) ->
                                {state(), slide_delta()}

Gets all DB changes in the given interval, stops recording delta infos and removes the entries in this range from the DB.

slide_add_delta/2

slide_add_delta(State :: state(), X2 :: slide_delta()) -> state()

Adds delta infos from slide_take_delta_stop_record/2 to the local DB.

slide_stop_record/3

slide_stop_record(State :: state(),
                  MovingInterval :: intervals:interval(),
                  RemoveDataInInterval :: boolean()) ->
                     state()

Stops recording changes in the given interval. Optionally, the data in this range can be deleted.

get_split_key/5

get_split_key(State :: state(),
              Begin :: rt_chord:key(),
              End :: rt_chord:key(),
              TargetLoad :: pos_integer(),
              Direction :: forward | backward) ->
                 {rt_chord:key(), TakenLoad :: pos_integer()}

Returns a key so that there are no more than TargetLoad entries between Begin and this key in the DBs.


Generated by EDoc, Sep 11 2020, 15:25:11.