ExRingRing.Domain.ValueObjects.HashConfig (ExRingRing v0.1.1)

Copy Markdown View Source

Value object representing hash ring configuration.

Summary

Functions

Calculates virtual node count for a node based on its weight.

Gets the hash algorithm.

Gets the hash mask.

Gets the max hash byte size.

Gets the virtual node count.

Creates a new hash configuration.

Types

t()

@type t() :: %ExRingRing.Domain.ValueObjects.HashConfig{
  algorithm: atom(),
  hash_mask: non_neg_integer(),
  max_hash_byte_size: pos_integer(),
  virtual_node_count: pos_integer()
}

Functions

calc_virtual_node_count(config, node)

@spec calc_virtual_node_count(t(), ExRingRing.Domain.Entities.Node.t()) ::
  non_neg_integer()

Calculates virtual node count for a node based on its weight.

get_algorithm(hash_config)

@spec get_algorithm(t()) :: atom()

Gets the hash algorithm.

get_hash_mask(hash_config)

@spec get_hash_mask(t()) :: non_neg_integer()

Gets the hash mask.

get_max_hash_byte_size(hash_config)

@spec get_max_hash_byte_size(t()) :: pos_integer()

Gets the max hash byte size.

get_virtual_node_count(hash_config)

@spec get_virtual_node_count(t()) :: pos_integer()

Gets the virtual node count.

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new hash configuration.