BPXE.Token (bpxe v0.4.0)

Link to this section Summary

Functions

Distance between generations of two tokens. Returns nil if they are not in the same activation (comparing them is useless), otherwise it's a number of single incremenets from the first token to the second one (positive means the second message is younger, negative is older, zero is it's the same generation)

Merges two tokens

Link to this section Functions

Link to this function

activation(token)

Link to this function

distance(first, second)

Distance between generations of two tokens. Returns nil if they are not in the same activation (comparing them is useless), otherwise it's a number of single incremenets from the first token to the second one (positive means the second message is younger, negative is older, zero is it's the same generation)

Link to this function

generation(token)

Link to this function

later_than(_, _)

Link to this function

merge(t1, token)

Merges two tokens

Examples

iex> BPXE.Token.merge(BPXE.Token.new(token_id: 1, payload: %{"a" => 1, "b" => %{"c" => 2}}), iex> BPXE.Token.new(token_id: 1, payload: %{"a" => 2, "b" => %{"d" => 4}})).payload %{"a" => 2, "b" => %{"c" => 2, "d" => 4}}

Link to this function

new(options \\ [])

Link to this function

new(map_or_kwlist, opts \\ [])

Specs

new(ExConstructor.map_or_kwlist(), Keyword.t()) :: %BPXE.Token{
  __generation__: term(),
  payload: term(),
  token_id: term()
}
Link to this function

next_generation(token)