class Newque::Zmq_tools

Constants

BASE_OPTIONS
ZMQ_OPT_MAPPING

BASE_OPTIONS, with the values being the ZMQ constants for those options

Public Class Methods

parse_input(buffers) click to toggle source
# File lib/newque/zmq/zmq_tools.rb, line 29
def self.parse_input buffers
  buf, *messages = buffers
  input = Input.decode buf

  action = if !input.write_input.nil?
    Write_request.new input.write_input.atomic, input.write_input.ids
  elsif !input.read_input.nil?
    Read_request.new input.read_input.mode, input.read_input.limit
  elsif !input.count_input.nil?
    Count_request.new
  elsif !input.delete_input.nil?
    Delete_request.new
  elsif !input.health_input.nil?
    Health_request.new input.health_input.global
  else
    raise NewqueError.new "Cannot find a valid message type"
  end

  Input_request.new input.channel, action, messages
end
set_zmq_sock_options(sock, options) click to toggle source
# File lib/newque/zmq/zmq_tools.rb, line 23
def self.set_zmq_sock_options sock, options
  options.each do |name, value|
    sock.setsockopt ZMQ_OPT_MAPPING[name], value
  end
end