lib/serfx/commands.rb
# query is used to issue a new query
#
# @param name [String] name of the query
# @param payload [String] payload for this query event
# @param opts [Hash] additional query options
# @return  [Response]
query is used to issue a new query
query is used to issue a new query
def query(name, payload, opts = {}, &block)
      params = { 'Name' => name, 'Payload' => payload }
      params.merge!(opts)
      res = request(:query, params)
      loop do
        header = read_data
        check_rpc_error!(header)
        ev = read_data
        break if ev['From'].nil? || ev['From'].empty?
        if ev['Type'] == 'done'
          break
        else
          block.call(ev) if block
        end
      end
      res
    end
def query ( name , payload , opts = { } , & block ) params = { 'Name' => name , 'Payload' => payload } params . merge! ( opts ) res = request ( :query , params ) loop do header = read_data check_rpc_error! ( header ) ev = read_data break if ev [ 'From' ] . nil? || ev [ 'From' ] . empty? if ev [ 'Type' ] == 'done' break else block . call ( ev ) if block end end res end
query is used to issue a new query
query is used to issue a new query
# Ignore responses with an empty From field
None
Response
name
name of the query
name of the query
payload
payload for this query event
payload for this query event
opts
additional query options
additional query options
block