logoot v1.0.0 Logoot.Agent

A GenServer which is responsible for storing a unique ID and the state of a vector clock for use in generating Logoot.Sequence.position_idents.

iex> {:ok, agent} = Logoot.Agent.start_link
iex> Logoot.Agent.tick_clock(agent).clock
1

Summary

Functions

Get the current state of the agent (ID and clock)

Start an agent whose initial clock value will be 0

Increment the agent’s clock by 1

Types

t :: %Logoot.Agent{clock: non_neg_integer, id: String.t}

Functions

get_state(pid)

Specs

get_state(pid) :: t

Get the current state of the agent (ID and clock).

start_link()

Specs

start_link :: GenServer.on_start

Start an agent whose initial clock value will be 0.

tick_clock(pid)

Specs

tick_clock(pid) :: t

Increment the agent’s clock by 1.