ExRingRing.Domain.Entities.Node (ExRingRing v0.1.1)

Copy Markdown View Source

Represents a node in the consistent hash ring.

A node has a key (used for hashing), data (user-defined payload), and weight (used to determine virtual node count).

Summary

Functions

Gets the node data.

Gets the node key.

Gets the node weight.

Checks if the given term is a valid node.

Creates a new node with the given key.

Creates a new node with the given key and data.

Creates a new node with the given key, data, and weight or options.

Types

t()

@type t() :: %ExRingRing.Domain.Entities.Node{
  data: term(),
  key: term(),
  weight: number()
}

Functions

get_data(node)

@spec get_data(t()) :: term()

Gets the node data.

get_key(node)

@spec get_key(t()) :: term()

Gets the node key.

get_weight(node)

@spec get_weight(t()) :: number()

Gets the node weight.

is_node(arg1)

@spec is_node(term()) :: boolean()

Checks if the given term is a valid node.

make(key)

@spec make(term()) :: t()

Creates a new node with the given key.

make(key, data)

@spec make(term(), term()) :: t()

Creates a new node with the given key and data.

make(key, data, weight)

@spec make(term(), term(), number() | keyword()) :: t()
@spec make(term(), term(), keyword()) :: t()

Creates a new node with the given key, data, and weight or options.