hyparview v0.1.4 Hyparview.Messages.Shuffle View Source

SHUFFLE request abstraction module

Link to this section Summary

Functions

If the time to live of the message is greater than zero and the number of nodes in q’s active view is greater than 1, the node will select a random node from its active view, different from the one he received this shuffle message from, and simply forwards the Shuffle request

%View{} = Shuffle.handle(shuffle, state.view)

Make a SHUFFLE message that includes nodes that active_view

Send a list in a Shuffle request to a random neighbor of its active view. list contains;

  • p’s own identifier
  • Ka nodes from its active view
  • Kp nodes from its passive view

if Shuffle.should_forward?(shuffle, view) do

  :ok = Shuffle.forward!(shuffle, view)
else
  :ok = ShuffleReply.new(passive: passive, shuffle: shuffle)
  |> ShuffleReply.send!(shuffle.sender)
end

Link to this section Types

Link to this type t() View Source
t() :: %Hyparview.Messages.Shuffle{
  nodes: MapSet.t(Node.t()),
  origin: Node.t(),
  sender: Node.t(),
  ttl: non_neg_integer()
}

Link to this section Functions

Link to this function forward!(shuffle, view) View Source
forward!(t(), Hyparview.View.t()) :: Hyparview.View.t()

If the time to live of the message is greater than zero and the number of nodes in q’s active view is greater than 1, the node will select a random node from its active view, different from the one he received this shuffle message from, and simply forwards the Shuffle request.

%View{} = Shuffle.handle(shuffle, state.view)
Link to this function new(options \\ []) View Source
new(new_options()) :: Hyparview.Messages.Shuffle.t()

Make a SHUFFLE message that includes nodes that active_view

shuffle = Shuffle.new(view: view)

Send a list in a Shuffle request to a random neighbor of its active view. list contains;

  • p’s own identifier
  • Ka nodes from its active view
  • Kp nodes from its passive view

    :ok = Shuffle.send!(shuffle, view)

Link to this function should_forward?(shuffle, view) View Source
should_forward?(t(), Hyparview.View.t()) :: boolean()
if Shuffle.should_forward?(shuffle, view) do
  :ok = Shuffle.forward!(shuffle, view)
else
  :ok = ShuffleReply.new(passive: passive, shuffle: shuffle)
  |> ShuffleReply.send!(shuffle.sender)
end