class Aggro::Locator

Public: Locates the nodes responsible for a given entity ID.

Public Class Methods

new(id) click to toggle source
# File lib/aggro/locator.rb, line 4
def initialize(id)
  @id = id
end

Public Instance Methods

local?() click to toggle source
# File lib/aggro/locator.rb, line 8
def local?
  primary_node.is_a? LocalNode
end
nodes() click to toggle source
# File lib/aggro/locator.rb, line 12
def nodes
  current_node_list_state = Aggro.node_list.state

  if @last_node_list_state == current_node_list_state
    @nodes ||= Aggro.node_list.nodes_for(@id)
  else
    @last_node_list_state = current_node_list_state

    @nodes = Aggro.node_list.nodes_for(@id)
  end
end
primary_node() click to toggle source
# File lib/aggro/locator.rb, line 24
def primary_node
  nodes.first
end
secondary_nodes() click to toggle source
# File lib/aggro/locator.rb, line 28
def secondary_nodes
  nodes[1..-1]
end