RendezvousHash
Object Hierarchy:
Description:
public class RendezvousHash : Object
Weighted rendezvous hash (highest-random-weight hashing).
RendezvousHash assigns each key to the node with the highest score. It also supports selecting top-N nodes for replication and per-node
weight for heterogeneous clusters.
Example:
var hash = new RendezvousHash ();
hash.addNode ("node-a");
hash.addNode ("node-b");
string? node = hash.getNode ("user:42");
Content:
Creation methods:
Methods:
- public Result<bool,Error> addNode (string nodeId)
Adds node to the hash set.
- public void clear ()
Removes all nodes and weights.
- public Result<bool,Error> containsNode (string nodeId)
Returns whether node exists.
- public HashMap<string,int> distribution (ArrayList<string> sampleKeys)
Returns distribution of sample keys per node.
- public Result<string?,Error> getNode (string key)
Returns assigned node for a key.
- public Result<ArrayList<string>,Error> getTopNodes (string key, int n)
Returns top-N nodes for key by score.
- public int nodeCount ()
Returns current node count.
- public double rebalanceEstimate (ArrayList<string> sampleKeys)
Estimates key remap ratio when one node is added.
- public Result<bool,Error> removeNode (string nodeId)
Removes node from the hash set.
- public Result<bool,Error> setWeight (string nodeId, double weight)
Sets weight for existing node.
Inherited Members:
All known members inherited from class GLib.Object
- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data
- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer
- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref