Class: Falcore::Node::Slave

Inherits:
Base
  • Object
show all
Defined in:
lib/falcore/nodes/slave.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#disk_space, #display_name, #executors, #free_memory, #free_swap, #idle?, #inspect, #offline?, #response_time, #temporarily_offline?, #temporary_space, #to_s, #total_memory, #total_swap

Constructor Details

#initialize(master, data = {}) ⇒ Slave

Returns a new instance of Slave.

Parameters:



28
29
30
31
32
33
34
35
36
37
# File 'lib/falcore/nodes/slave.rb', line 28

def initialize(master, data = {})
  super(data)

  unless master.is_a?(Node::Master)
    raise ArgumentError, "#{master.class} is not an Falcore::Node::Master!"
  end

  @master = master
  @master.add_slave(self)
end

Instance Attribute Details

#masterNode::Master (readonly)

Returns:



22
23
24
# File 'lib/falcore/nodes/slave.rb', line 22

def master
  @master
end

Instance Method Details

#idString

Namespace the slave under it’s master.

Returns:

  • (String)


44
45
46
# File 'lib/falcore/nodes/slave.rb', line 44

def id
  "#{@master.id}.#{display_name.gsub(/\./, '-')}"
end