Nebulex.Distributed.Cluster (Nebulex.Distributed v3.0.0-rc.1)

View Source

This module is used by cache adapters for distributed caching functionality.

Summary

Functions

Finds a node in the ring.

Joins the node where the cache name's supervisor process is running to the name's node group.

Makes the node where the cache name's supervisor process is running, leave the name's node group.

Returns the :pg child spec.

Returns the list of nodes joined to given name's node group.

Returns the :pg scope.

Returns the list of nodes in the ring.

Functions

find_node(ring, key)

@spec find_node(ExHashRing.Ring.ring(), any()) ::
  {:ok, node()} | {:error, Nebulex.Error.t()}

Finds a node in the ring.

join(name)

@spec join(name :: atom()) :: :ok

Joins the node where the cache name's supervisor process is running to the name's node group.

leave(name)

@spec leave(name :: atom()) :: :ok

Makes the node where the cache name's supervisor process is running, leave the name's node group.

monitor_scope()

@spec monitor_scope() :: reference()

Wrapper for :pg.monitor_scope/1.

pg_child_spec()

@spec pg_child_spec() :: Supervisor.child_spec()

Returns the :pg child spec.

pg_nodes(name)

@spec pg_nodes(name :: atom()) :: [node()]

Returns the list of nodes joined to given name's node group.

pg_scope()

@spec pg_scope() :: atom()

Returns the :pg scope.

ring_nodes(ring)

@spec ring_nodes(ExHashRing.Ring.ring()) :: [node()]

Returns the list of nodes in the ring.