class RaptorIO::Socket::SwitchBoard::Route

A logical switch board route.

Attributes

comm[RW]
netmask[RW]
subnet[RW]

Public Class Methods

new(subnet, netmask, comm) click to toggle source

@param subnet [String,IPAddr] The network associated with this

route. If specified as a String, must be parseable by IPAddr.new

@param netmask [String,IPAddr] ‘subnet`’s netmask. If specified as

a String, must be parseable by IPAddr.new

@param comm [Comm] The endpoint where sockets for this route

should be created.
# File lib/raptor-io/socket/switch_board/route.rb, line 16
def initialize(subnet, netmask, comm)
  self.netmask = IPAddr.parse(netmask)
  self.subnet  = IPAddr.parse(subnet).mask netmask.to_s
  self.comm    = comm
end

Public Instance Methods

<=>(other) click to toggle source

For comparison, sort according to netmask.

This allows {Route routes} to be ordered by specificity

# File lib/raptor-io/socket/switch_board/route.rb, line 35
def <=>(other)
  netmask <=> other.netmask
end
==(other) click to toggle source

For direct equality, make sure all the attributes are the same

# File lib/raptor-io/socket/switch_board/route.rb, line 25
def ==(other)
  return false unless other.kind_of? RaptorIO::Socket::SwitchBoard::Route
  netmask == other.netmask && subnet == other.subnet && comm == other.comm
end