Copyright © 2007-2013 Zuse Institute Berlin
Version: $Id$
Behaviours: rt_beh.
Authors: Thorsten Schuett (schuett@zib.de).
client_key() = [unicode_char()]
custom_message() = {rt_get_node,
Source_PID :: comm:mypid(),
Index :: index()}
| {rt_get_node_response,
Index :: index(),
Node :: node:node_type()}
userdevguide-end rt_chord:types
external_rt() =
gb_trees:tree(NodeId :: key(), Node :: node:node_type())
index() = {pos_integer(), non_neg_integer()}
key() = 0..340282366920938463463374607431768211455
128 bit numbers
abstract datatype: rt()
unicode_char() = 0..55295 | 57344..65533 | 65536..1114111
| add_range/2 | Adds the given range, i.e. |
| check/4 | Notifies the dht_node and failure detector if the routing table changed. |
| check/5 | Notifies the dht_node if the (external) routing table changed. |
| check_config/0 | Checks whether config parameters of the rt_chord process exist and are valid. |
| client_key_to_binary/1 | |
| dump/1 | Dumps the RT state for output in the web interface. |
| empty_ext/1 | |
| export_rt_to_dht_node/2 | |
| filter_dead_node/3 | Removes dead nodes from the routing table. |
| get_key_segment/1 | |
| get_random_in_interval/1 | Gets input similar to what intervals:get_bounds/1 returns and calculates a random key in this range. |
| get_random_in_interval/2 | Gets input similar to what intervals:get_bounds/1 returns and calculates Count number of random keys in this range (duplicates may exist!). |
| get_random_node_id/0 | Generates a random node id, i.e. |
| get_range/2 | Gets the number of keys in the interval (Begin, End]. |
| get_replica_keys/1 | Returns the replicas of the given key. |
| get_size/1 | Returns the size of the routing table. |
| get_split_key/3 | Gets the key that splits the interval (Begin, End] so that the first interval will (roughly) be (Num/Denom) * range(Begin, End). |
| get_split_keys/3 | Splits the range between Begin and End into up to Parts equal parts and returning the according split keys. |
| handle_custom_message/2 | Chord reacts on 'rt_get_node_response' messages in response to its 'rt_get_node' messages. |
| hash_key/1 | Hashes the key to the identifier space. |
| init/1 | Initialize the routing table. |
| init_stabilize/2 | Starts the stabilization routine. |
| n/0 | Returns the size of the address space. |
| next_hop/2 | Returns the next hop to contact for a lookup. |
| to_list/1 | Converts the (external) representation of the routing table to a list in the order of the fingers, i.e. |
| to_pid_list/1 | Returns the pids of the routing table entries. |
| unwrap_message/2 | Unwrap lookup messages. |
| update/3 | Updates the routing table due to a changed node ID, pred and/or succ. |
| wrap_message/4 | Wrap lookup messages. |
client_key_to_binary(Key :: client_key()) -> binary()
init(Neighbors :: nodelist:neighborhood()) -> rt()
Initialize the routing table. This function is allowed to send messages.
hash_key(Key :: binary() | client_key()) -> key()
Hashes the key to the identifier space.
get_random_node_id() -> key()
Generates a random node id, i.e. a random 128-bit number, based on the parameters set in the config file (key_creator and key_creator_bitmask).
init_stabilize(Neighbors :: nodelist:neighborhood(), RT :: rt()) -> rt()
Starts the stabilization routine.
filter_dead_node(RT :: rt(), DeadPid :: comm:mypid(), Reason :: fd:reason()) -> rt()
Removes dead nodes from the routing table.
to_pid_list(RT :: rt()) -> [comm:mypid()]
Returns the pids of the routing table entries.
get_size(RT :: rt() | external_rt()) -> non_neg_integer()
Returns the size of the routing table.
n() -> 340282366920938463463374607431768211456
Returns the size of the address space.
Adds the given range, i.e. Range/n() parts of the key space, to the given key.
Gets the number of keys in the interval (Begin, End]. In the special case of Begin==End, the whole key range as specified by n/0 is returned.
get_split_key(Begin :: key(), End :: key() | 340282366920938463463374607431768211456, SplitFraction :: {Num :: number(), Denom :: pos_integer()}) -> key() | 340282366920938463463374607431768211456
Gets the key that splits the interval (Begin, End] so that the first interval will (roughly) be (Num/Denom) * range(Begin, End). In the special case of Begin==End, the whole key range is split. Beware: (Num/Denom) must be in [0, 1]; the final key will be rounded down and may thus be Begin.
get_split_keys(Begin :: key(), End :: key() | 340282366920938463463374607431768211456, Parts :: pos_integer()) -> [key()]
Splits the range between Begin and End into up to Parts equal parts and returning the according split keys.
get_random_in_interval(I :: intervals:simple_interval2()) -> key()
Gets input similar to what intervals:get_bounds/1 returns and calculates a random key in this range. Fails with an exception if there is no key.
get_random_in_interval(X1 :: intervals:simple_interval2(), Count :: pos_integer()) -> [key(), ...]
Gets input similar to what intervals:get_bounds/1 returns and calculates Count number of random keys in this range (duplicates may exist!). Fails with an exception if there is no key.
Returns the replicas of the given key.
get_key_segment(Key :: key()) -> pos_integer()
dump(RT :: rt()) -> KeyValueList :: [{Index :: string(), Node :: string()}]
Dumps the RT state for output in the web interface.
update(OldRT :: rt(), OldNeighbors :: nodelist:neighborhood(), NewNeighbors :: nodelist:neighborhood()) -> {ok | trigger_rebuild, rt()}
Updates the routing table due to a changed node ID, pred and/or succ.
check_config() -> boolean()
Checks whether config parameters of the rt_chord process exist and are valid.
handle_custom_message(Message :: custom_message(), State :: rt_loop:state_active()) -> rt_loop:state_active() | unknown_event
Chord reacts on 'rt_get_node_response' messages in response to its 'rt_get_node' messages.
check(OldRT :: rt(), NewRT :: rt(), Neighbors :: nodelist:neighborhood(), ReportToFD :: boolean()) -> ok
Notifies the dht_node and failure detector if the routing table changed. Provided for convenience (see check/5).
check(OldRT :: rt(), NewRT :: rt(), OldNeighbors :: nodelist:neighborhood(), NewNeighbors :: nodelist:neighborhood(), ReportToFD :: boolean()) -> ok
Notifies the dht_node if the (external) routing table changed. Also updates the failure detector if ReportToFD is set. Note: the external routing table also changes if the Pred or Succ change.
empty_ext(Neighbors :: nodelist:neighborhood()) -> external_rt()
next_hop(State :: dht_node_state:state(), Id :: key()) -> {succ | other, comm:mypid()}
Returns the next hop to contact for a lookup. If the routing table has less entries than the rt_size_use_neighbors config parameter, the neighborhood is also searched in order to find a proper next hop. Note, that this code will be called from the dht_node process and it will thus have an external_rt!
export_rt_to_dht_node(RT :: rt(), Neighbors :: nodelist:neighborhood()) -> external_rt()
to_list(State :: dht_node_state:state()) -> nodelist:snodelist()
Converts the (external) representation of the routing table to a list in the order of the fingers, i.e. first=succ, second=shortest finger, third=next longer finger,...
wrap_message(Key :: key(), Msg :: comm:message(), State :: dht_node_state:state(), Hops :: non_neg_integer()) -> comm:message()
Wrap lookup messages. This is a noop in Chord.
unwrap_message(Msg :: comm:message(), State :: dht_node_state:state()) -> comm:message()
Unwrap lookup messages. This is a noop in Chord.
Generated by EDoc, Jul 23 2015, 22:20:33.