README

Name

gqtp

Description

Gqtp gem is a GQTP (Groonga Query Transfer Protocol) Ruby implementation.

Gqtp gem provides both GQTP client, GQTP server and GQTP proxy implementations. They provide asynchronous API. You can use gqtp gem for high concurrency use.

Install

% gem install gqtp

Usage

Client

client = GQTP::Client.new(:address => "192.168.0.1", :port => 10041)
request = client.send("status") do |header, body|
  p body # => "{\"alloc_count\":163,...}"
end
request.wait

Server

server = GQTP::Server.new(:address => "192.168.0.1", :port => 10041)
server.on_request do |request, client|
  body = "{\"alloc_count\":163,...}"
  header = GQTP::Header.new
  header.query_type = GQTP::Header::ContentType::JSON
  header.flags = GQTP::Header::Flag::TAIL
  header.size = body.bytesize
  client.write(header.pack, body) do
    client.close
  end
end
server.run.wait

Proxy

proxy = GQTP::Proxy.new(:listen_address => "127.0.0.1",
                        :listen_port => 10041,
                        :upstream_address => "192.168.0.1",
                        :upstream_port => 10041)
proxy.run.wait

Dependencies

  • Ruby 1.9.3

Mailing list

Thanks

  • ...

Authors

License

LGPLv2.1 or later. See doc/text/lgpl-2.1.txt for details.

(Kouhei Sutou has a right to change the license including contributed patches.)