ExRingRing.Domain.Services.HashRing behaviour (ex_ring_ring v0.1.0)

Copy Markdown

Domain service behavior for hash ring operations.

This defines the contract for hash ring implementations.

Summary

Types

fold_fun()

@type fold_fun() :: (ExRingRing.Domain.Entities.Node.t(), term() ->
                 {boolean(), term()})

item()

@type item() :: term()

node_map()

@type node_map() :: %{required(term()) => ExRingRing.Domain.Entities.Node.t()}

Callbacks

add_nodes(list, term)

@callback add_nodes([ExRingRing.Domain.Entities.Node.t()], term()) :: term()

fold(fold_fun, item, term, term)

@callback fold(fold_fun(), item(), term(), term()) :: term()

get_nodes(term)

@callback get_nodes(term()) :: node_map()

get_non_phantom_node_count(term)

@callback get_non_phantom_node_count(term()) :: non_neg_integer()

hash(item, term)

@callback hash(item(), term()) :: non_neg_integer()

make(list, t)

remove_nodes(list, term)

@callback remove_nodes([atom() | binary() | integer()], term()) :: term()