exsozu v0.3.0 ExSozu behaviour View Source

Provides the main API to interface with Sōzu and handles the connection.

Answers

Answers from Sōzu should be handled in a GenServer.handle_info/2 callback.

Messages will be in these formats:

{:answer, %ExSozu.Answer{status: :ok}}
{:answer, %ExSozu.Answer{status: :processing}}
{:answer, %ExSozu.Answer{status: :error}}

Reconnections

ExSozu will try to recover automatically from network errors: if there’s a network error, ExSozu will try to reconnect after 500 milliseconds. If it fails to do so, it’ll try again in 500 * 2 milliseconds, then in 500 * 2 * 2 milliseconds, etc.

Link to this section Summary

Functions

Sends command to Sōzu

Sends a list of commands to Sōzu

Link to this section Functions

Link to this function command(command) View Source
command(ExSozu.Command.t()) :: {:ok, command_id :: String.t()}

Sends command to Sōzu.

Link to this function pipeline(commands) View Source
pipeline([ExSozu.Command.t()]) :: {:ok, command_ids :: [String.t()]}

Sends a list of commands to Sōzu.

Link to this section Callbacks

Link to this callback handle_info({}, state) View Source
handle_info({:answer, ExSozu.Answer.t()}, state :: term()) :: term()