gqtp 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -1,5 +1,13 @@
1
1
  # News
2
2
 
3
+ ## 1.0.1: 2012-12-29
4
+
5
+ ## Improvements
6
+
7
+ * [client] Sent
8
+ [quit command](http://groonga.org/docs/reference/commands/quit.html)
9
+ on close.
10
+
3
11
  ## 1.0.0: 2012-11-29
4
12
 
5
13
  The first release!!!
@@ -28,8 +28,8 @@ module GQTP
28
28
  @connection = create_connection
29
29
  end
30
30
 
31
- def send(body, &block)
32
- header = Header.new
31
+ def send(body, options={}, &block)
32
+ header = options[:header] || Header.new
33
33
  header.size = body.bytesize
34
34
 
35
35
  write_request = @connection.write(header.pack, body) do
@@ -65,7 +65,18 @@ module GQTP
65
65
  end
66
66
 
67
67
  def close
68
- @connection.close
68
+ sync = !block_given?
69
+ ack_request = nil
70
+ quit_request = send("quit", :header => header_for_close) do
71
+ ack_request = send("ACK", :header => header_for_close) do
72
+ @connection.close
73
+ yield if block_given?
74
+ end
75
+ end
76
+ if sync
77
+ quit_request.wait
78
+ ack_request.wait
79
+ end
69
80
  end
70
81
 
71
82
  private
@@ -82,5 +93,9 @@ module GQTP
82
93
  connection_module = GQTP::Connection::const_get(module_name)
83
94
  connection_module::Client.new(@options)
84
95
  end
96
+
97
+ def header_for_close
98
+ Header.new(:flags => Header::Flag::HEAD)
99
+ end
85
100
  end
86
101
  end
@@ -17,5 +17,5 @@
17
17
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
19
  module GQTP
20
- VERSION = "1.0.0"
20
+ VERSION = "1.0.1"
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gqtp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-29 00:00:00.000000000 Z
12
+ date: 2012-12-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -126,22 +126,22 @@ files:
126
126
  - Gemfile
127
127
  - gqtp.gemspec
128
128
  - lib/gqtp/parser.rb
129
- - lib/gqtp/header.rb
130
- - lib/gqtp/error.rb
131
- - lib/gqtp/version.rb
132
- - lib/gqtp/proxy.rb
133
129
  - lib/gqtp/server.rb
134
- - lib/gqtp/connection/coolio.rb
135
130
  - lib/gqtp/connection/thread.rb
131
+ - lib/gqtp/connection/coolio.rb
136
132
  - lib/gqtp/connection/synchronous.rb
133
+ - lib/gqtp/version.rb
134
+ - lib/gqtp/header.rb
137
135
  - lib/gqtp/client.rb
136
+ - lib/gqtp/proxy.rb
137
+ - lib/gqtp/error.rb
138
138
  - lib/gqtp.rb
139
139
  - doc/text/news.md
140
140
  - doc/text/lgpl-2.1.txt
141
141
  - test/run-test.rb
142
- - test/test-client.rb
143
- - test/test-parser.rb
144
142
  - test/test-header.rb
143
+ - test/test-parser.rb
144
+ - test/test-client.rb
145
145
  - bin/gqtp-proxy
146
146
  homepage: https://github.com/ranguba/gqtp
147
147
  licenses:
@@ -156,12 +156,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
156
  - - ! '>='
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
+ segments:
160
+ - 0
161
+ hash: -1703011211465073538
159
162
  required_rubygems_version: !ruby/object:Gem::Requirement
160
163
  none: false
161
164
  requirements:
162
165
  - - ! '>='
163
166
  - !ruby/object:Gem::Version
164
167
  version: '0'
168
+ segments:
169
+ - 0
170
+ hash: -1703011211465073538
165
171
  requirements: []
166
172
  rubyforge_project:
167
173
  rubygems_version: 1.8.23
@@ -171,7 +177,7 @@ summary: Gqtp gem is a [GQTP (Groonga Query Transfer Protocol)](http://groonga.o
171
177
  Ruby implementation.
172
178
  test_files:
173
179
  - test/run-test.rb
174
- - test/test-client.rb
175
- - test/test-parser.rb
176
180
  - test/test-header.rb
181
+ - test/test-parser.rb
182
+ - test/test-client.rb
177
183
  has_rdoc: