Class: Pan_rack

Inherits:
Object
  • Object
show all
Defined in:
rlib/pan_rack.rb

Overview

Container for a rack in the Pan cluster in the TDC

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Pan_rack) initialize(rack_name, pan_host = nil)

Create a Pan_rack instance

Parameters:

  • rack_name (String)

    TDC rack name, for reference.

  • pan_host (Pan_host, Array<Pan_host>) (defaults to: nil)

    A node in the rack, or Array of nodes to initialize the rack host list with.



10
11
12
13
14
15
16
17
18
# File 'rlib/pan_rack.rb', line 10

def initialize(rack_name, pan_host=nil)
  @rack_name = rack_name
  @hosts = []
  if pan_host.class == Array
    pan_host.each { |ph| @host << ph }
  elsif pan_host != nil
    @hosts << pan_host
  end
end

Instance Attribute Details

- (Object) hosts

Hosts indexed by U



4
5
6
# File 'rlib/pan_rack.rb', line 4

def hosts
  @hosts
end

- (Object) rack_name

Returns the value of attribute rack_name



3
4
5
# File 'rlib/pan_rack.rb', line 3

def rack_name
  @rack_name
end

Instance Method Details

- (Pan_host) [](index)

Accessing directly into the racks @hosts Array

Parameters:

  • index (Fixnum)

    the Array index into the @hosts Array

Returns:



31
32
33
# File 'rlib/pan_rack.rb', line 31

def [](index)
  @hosts[index]
end

- (Pan_host) []=(index, value)

Assignment to the racks @host Array

Parameters:

  • index (Fixnum)

    the Array index into the @hosts Array

  • value (Pan_host)

    The host details we want to insert into this position

Returns:



24
25
26
# File 'rlib/pan_rack.rb', line 24

def []=(index,value)
  @hosts[index] = value
end