View Source KantanCluster (kantan_cluster v0.5.0)

KantanCluster

かんたんクラスター

Hex version API docs CI

Summary

Types

Options for a cluster.

Types

@type message() :: any()
@type node_name() :: atom() | binary()
@type option() ::
  {:name, node()}
  | {:sname, node()}
  | {:cookie, atom()}
  | {:topologies, keyword()}

Options for a cluster.

@type topic() :: binary()

Functions

Link to this function

broadcast(topic, message)

View Source
@spec broadcast(topic(), message()) :: :ok | {:error, term()}

See Phoenix.PubSub.broadcast/4

Link to this function

broadcast!(topic, message)

View Source
@spec broadcast!(topic(), message()) :: :ok

See Phoenix.PubSub.broadcast!/4

Link to this function

broadcast_from(from, topic, message)

View Source
@spec broadcast_from(pid(), topic(), message()) :: :ok | {:error, term()}

See Phoenix.PubSub.broadcast_from/5

Link to this function

broadcast_from!(from, topic, message)

View Source
@spec broadcast_from!(pid(), topic(), message()) :: :ok

See Phoenix.PubSub.broadcast_from!/5

Link to this function

direct_broadcast(node_name, topic, message)

View Source
@spec direct_broadcast(node_name(), topic(), message()) :: :ok

See Phoenix.PubSub.direct_broadcast/5

Link to this function

direct_broadcast!(node_name, topic, message)

View Source
@spec direct_broadcast!(node_name(), topic(), message()) :: :ok

See Phoenix.PubSub.direct_broadcast!/5

Link to this function

local_broadcast(topic, message)

View Source
@spec local_broadcast(topic(), message()) :: :ok

See Phoenix.PubSub.local_broadcast/4

Link to this function

local_broadcast_from(from, topic, message)

View Source
@spec local_broadcast_from(pid(), topic(), message()) :: :ok

See Phoenix.PubSub.local_broadcast_from/5

@spec node_name() :: node_name()

See Phoenix.PubSub.node_name/1

@spec start_node([option()]) :: :ok

Starts a node. Configuration options can be specified as a keyword argument

KantanCluster.start(
  name: :"hoge@172.17.0.7",
  cookie: :mycookie
)

or in your config/config.exs.

config :kantan_cluster,
  name: :"hoge@172.17.0.7",
  cookie: :mycookie
Link to this function

subscribe(topic, opts \\ [])

View Source
@spec subscribe(topic(), keyword()) :: :ok | {:error, term()}

See Phoenix.PubSub.subscribe/3

@spec unsubscribe(topic()) :: :ok

See Phoenix.PubSub.unsubscribe/2