class Pontoon::Goliath

Attributes

node[R]
running[R]
update_fiber[R]

Public Class Methods

async_provider() click to toggle source
# File lib/pontoon/goliath.rb, line 212
def self.async_provider
  EventMachineAsyncProvider.new
end
log(message) click to toggle source
# File lib/pontoon/goliath.rb, line 8
def self.log(message)
  #STDOUT.write("\n\n")
  #STDOUT.write(message)
  #STDOUT.write("\n\n")
end
new(node) click to toggle source
# File lib/pontoon/goliath.rb, line 216
def initialize(node)
  @node = node
end
rpc_provider(uri_generator) click to toggle source
# File lib/pontoon/goliath.rb, line 208
def self.rpc_provider(uri_generator)
  HttpJsonRpcProvider.new(uri_generator)
end

Public Instance Methods

start(options = {}) click to toggle source
# File lib/pontoon/goliath.rb, line 224
    def start(options = {})
      @runner = ::Goliath::Runner.new(ARGV, nil)
      @runner.api = HttpJsonRpcResponder.new(node)
      @runner.app = ::Goliath::Rack::Builder.build(HttpJsonRpcResponder, @runner.api)
      @runner.address = options[:address] if options[:address]
      @runner.port = options[:port] if options[:port]
      @runner.run
      @running = true

      update_proc = Proc.new do
        EM.synchrony do
          @node.update
        end
      end
      @update_timer = EventMachine.add_periodic_timer(node.config.update_interval, update_proc)
#      @node.update
    end
stop() click to toggle source
# File lib/pontoon/goliath.rb, line 242
def stop
  @update_timer.cancel
end