Beethoven.SeekChat (Beethoven v0.3.7)

Module to simplify the interface between nodes during the locator Seeking flow.

Summary

Types

Type for sending messages between Locator and Listening Servers.

Message payload.

Request type for a node seeking message.

Functions

Deserializes a binary into msg() type.

Serializes a msg() object into a binary.

Creates a new msg, in the form of msg().

Types

msg()

@type msg() :: %{sender: node(), type: type(), payload: payload()}

Type for sending messages between Locator and Listening Servers.

payload()

@type payload() ::
  :join
  | :check
  | :self
  | [node()]
  | :standalone
  | :joined
  | :join_failed
  | :error

Message payload.

Options:

  • :join --> (CLIENT) Seeking to join a cluster.
  • :check --> (CLIENT) Client is watching, and wants to know if we are in a cluster.
  • :self --> (SERVER) When client calls its own listener.
  • list(node()) --> (SERVER) When client is watching, and server is in a cluster.
  • :standalone --> (SERVER) When client is watching, and the server is in standalone mode.
  • :joined --> (SERVER) Client request to join was successful.
  • :join_failed --> (SERVER) Client request to join failed.
  • :error --> (SERVER) Generic error occurred.

type()

@type type() :: :seeking | :watching | :reply

Request type for a node seeking message.

Client Options

  • :seeking --> Client looking to join.
  • :watching --> Client checking if anything else is listening.

Server Options

  • :reply --> Server response to either message

Functions

decode(msg)

@spec decode(binary()) :: msg()

Deserializes a binary into msg() type.

encode(msg)

@spec encode(msg()) :: binary()

Serializes a msg() object into a binary.

new_msg(type, payload)

@spec new_msg(type(), payload()) :: msg()

Creates a new msg, in the form of msg().

type()

  • :seeking --> (CLIENT) Client looking to join.
  • :watching --> (CLIENT) Client checking if anything else is listening.
  • :reply --> (SERVER) Server response to either message

payload():

  • :join --> (CLIENT) Seeking to join a cluster.
  • :check --> (CLIENT) Client is watching, and wants to know if we are in a cluster.
  • :self --> (SERVER) When client calls its own listener.
  • list(node()) --> (SERVER) When client is watching, and server is in a cluster.
  • :standalone --> (SERVER) When client is watching, and the server is in standalone mode.
  • :joined --> (SERVER) Client request to join was successful.
  • :join_failed --> (SERVER) Client request to join failed.
  • :error --> (SERVER) Generic error occurred.