class FnordMetric::UDPAcceptor

Attributes

opts[RW]

Public Class Methods

start(opts) click to toggle source
# File lib/fnordmetric/acceptors/udp_acceptor.rb, line 7
def self.start(opts)
  self.opts = opts

  EM.open_datagram_socket(*(opts[:listen] << self << opts))
end

Public Instance Methods

api() click to toggle source
# File lib/fnordmetric/acceptors/udp_acceptor.rb, line 33
def api
  @api ||= FnordMetric::API.new(FnordMetric.options)
end
events() click to toggle source
# File lib/fnordmetric/acceptors/udp_acceptor.rb, line 29
def events
  @events ||= []
end
push_next_event() click to toggle source
# File lib/fnordmetric/acceptors/udp_acceptor.rb, line 18
def push_next_event
  return true if events.empty?
  ev = @events.pop
  api.event(ev)
  EM.next_tick(&method(:push_next_event))
end
receive_data(event) click to toggle source
# File lib/fnordmetric/acceptors/udp_acceptor.rb, line 13
def receive_data(event)
  events << event
  push_next_event
end
unbind() click to toggle source
# File lib/fnordmetric/acceptors/udp_acceptor.rb, line 25
def unbind
  #backend.hangup
end