Prioritize a list of IPs for a specific key in increasing order for their weight. The original algorithm in http://www.eecs.umich.edu/techreports/cse/96/CSE-TR-316-96.pdf goes for the highest weight available, but describes that no loss of generality will happen going with LRW or HRW (see page 13 of the technical report). This module implements LRW specifically.
Do note that this implements the algorithm as mentioned in the paper, and as such does not support IPv6 at this time.hashfun() = fun((Key::term(), Node::term()) -> number())
all/2 | Returns the given set of nodes sorted in increasing order of their weight for a given key. |
all/3 | Returns the given set of nodes sorted in increasing order of their weight for a given key. |
all_ip/2 | Like all/2 but for IPs specifically; with an optimized hash. |
top/3 | Only keep the N top entries, compared to all/2 . |
top/4 | Only keep the N top entries, compared to all/3 . |
top_ip/3 | Like top/3 but optimized with a special hash for IPs. |
all(Key::term(), Nodes::[Node, ...]) -> [Node, ...]
Returns the given set of nodes sorted in increasing order of their weight for a given key. The weights aren't included in the returned results.
all(Key::term(), Nodes::[Node, ...], Hash::hashfun()) -> [Node, ...]
Returns the given set of nodes sorted in increasing order of their weight for a given key. The weights aren't included in the returned results. The third argument must be a function that accepts and returns arbitrary hashes.
all_ip(Key::term(), NodeIPs::[NodeIP, ...]) -> [NodeIP, ...]
Like all/2
but for IPs specifically; with an optimized hash.
top(Key::term(), Nodes::[Node, ...], Len::pos_integer()) -> [Node, ...]
Only keep the N
top entries, compared to all/2
. Note that
this call is unoptimized and just picks a sublist of the all/2
algorithm.
top(Key::term(), Nodes::[Node, ...], Len::pos_integer(), Hash::hashfun()) -> [Node, ...]
Only keep the N
top entries, compared to all/3
. Note that
this call is unoptimized and just picks a sublist of the all/3
algorithm.
The fourth argument must be a function that accepts and returns arbitrary
hashes.
top_ip(Key::term(), NodeIPs::[NodeIP, ...], Len::pos_integer()) -> [NodeIP, ...]
Like top/3
but optimized with a special hash for IPs.
Generated by EDoc