Module lrw

Prioritize a list of IPs for a specific key in increasing order for their weight.

Description

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.

Data Types

hashfun()

hashfun() = fun((Key::term(), Node::term()) -> number())

Function Index

all/2Returns the given set of nodes sorted in increasing order of their weight for a given key.
all/3Returns the given set of nodes sorted in increasing order of their weight for a given key.
all_ip/2Like all/2 but for IPs specifically; with an optimized hash.
top/3Only keep the N top entries, compared to all/2.
top/4Only keep the N top entries, compared to all/3.
top_ip/3Like top/3 but optimized with a special hash for IPs.

Function Details

all/2

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/3

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/2

all_ip(Key::term(), NodeIPs::[NodeIP, ...]) -> [NodeIP, ...]

Like all/2 but for IPs specifically; with an optimized hash.

top/3

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/4

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/3

top_ip(Key::term(), NodeIPs::[NodeIP, ...], Len::pos_integer()) -> [NodeIP, ...]

Like top/3 but optimized with a special hash for IPs.


Generated by EDoc