Sha256: e3b44b3d4fb39ba080e0f1fa76aa3f60b274bdad2509260b107c91504ff3e0a7

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

class NetworkDiscoveryApp<Service
  DISCOVERY=[:networkDiscoveryLocalstore,:networkDiscoveryUdp]
  
  requires *DISCOVERY
  provides :networkDiscovery
  
  
  def initialize(cluster,options)
    super(cluster,options,:networkDiscovery)
    
    
    @discovery=options[:discovery]
    @discovery||=DISCOVERY
    
  end
  
  def add(node)
    @discovery.each{|d|
      a=getApp(d)
      if a
        a.add(node)
      end
    }
  end
  
  def remove(node)
    @discovery.each{|d|
      a=getApp(d)
      if a
        a.remove(node)
      end
    }
  end

  def get
    @discovery.map{|d|
      a=getApp(d)
      if a
        a.get
      else
        []
      end
    }.flatten.uniq
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appswarm-0.0.1 apps/network_discovery/network_discovery.rb