moped 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/moped/connection.rb +10 -9
- data/lib/moped/protocol/message.rb +10 -8
- data/lib/moped/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c45c765e5368decfb1b558ccd8574a658697ecf2
|
4
|
+
data.tar.gz: 5d4344b505bc2e1a2c9d418c5b84d321ab426d00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a7780f10e4036d42b942bfa5dc9f4073b6d55b2984fa342e451a82887f7c2012e3fc40f6a900a617ca77b55f00e9854df2b02e23220e1b3ba0cba6e13deb590
|
7
|
+
data.tar.gz: 1da0fac786faea2334f9bb5d1937e37440e5b8bd257025fc194764a383edc959ef3ee198e4ac2539c355289d67c736a5f60d610331200fbcd8b27153a698a578
|
data/CHANGELOG.md
CHANGED
data/lib/moped/connection.rb
CHANGED
@@ -3,7 +3,6 @@ require "moped/connection/manager"
|
|
3
3
|
require "moped/connection/sockets"
|
4
4
|
|
5
5
|
module Moped
|
6
|
-
|
7
6
|
# This class contains behaviour of database socket connections.
|
8
7
|
#
|
9
8
|
# @since 2.0.0
|
@@ -15,6 +14,8 @@ module Moped
|
|
15
14
|
# @since 2.0.0
|
16
15
|
TIMEOUT = 5
|
17
16
|
|
17
|
+
REPLY_DECODE_STR = 'l<5q<l<2'
|
18
|
+
|
18
19
|
# @!attribute host
|
19
20
|
# @return [ String ] The ip address of the host.
|
20
21
|
# @!attribute options
|
@@ -114,15 +115,15 @@ module Moped
|
|
114
115
|
with_connection do |socket|
|
115
116
|
reply = Protocol::Reply.allocate
|
116
117
|
data = read_data(socket, 36)
|
117
|
-
response = data.unpack(
|
118
|
+
response = data.unpack(REPLY_DECODE_STR)
|
118
119
|
reply.length,
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
120
|
+
reply.request_id,
|
121
|
+
reply.response_to,
|
122
|
+
reply.op_code,
|
123
|
+
reply.flags,
|
124
|
+
reply.cursor_id,
|
125
|
+
reply.offset,
|
126
|
+
reply.count = response
|
126
127
|
|
127
128
|
if reply.count == 0
|
128
129
|
reply.documents = []
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Moped
|
2
2
|
module Protocol
|
3
|
-
|
4
3
|
# The base class for building all messages needed to implement the Mongo
|
5
4
|
# Wire Protocol. It provides a minimal DSL for defining typed fields for
|
6
5
|
# serialization and deserialization over the wire.
|
@@ -34,6 +33,9 @@ module Moped
|
|
34
33
|
# int32 :op_code
|
35
34
|
#
|
36
35
|
module Message
|
36
|
+
INT32_DECODE_STR = 'l<'
|
37
|
+
INT64_DECODE_ARRAY_STR = 'q<*'
|
38
|
+
INT64_DECODE_STR = 'q<'
|
37
39
|
|
38
40
|
# Default implementation for a message is to do nothing when receiving
|
39
41
|
# replies.
|
@@ -214,11 +216,11 @@ module Moped
|
|
214
216
|
end
|
215
217
|
|
216
218
|
def serialize_#{name}(buffer)
|
217
|
-
buffer << [#{name}_as_int].pack(
|
219
|
+
buffer << [#{name}_as_int].pack(INT32_DECODE_STR)
|
218
220
|
end
|
219
221
|
|
220
222
|
def deserialize_#{name}(buffer)
|
221
|
-
bits, = buffer.read(4).unpack(
|
223
|
+
bits, = buffer.read(4).unpack(INT32_DECODE_STR)
|
222
224
|
|
223
225
|
self.#{name} = bits
|
224
226
|
end
|
@@ -244,11 +246,11 @@ module Moped
|
|
244
246
|
end
|
245
247
|
|
246
248
|
def serialize_#{name}(buffer)
|
247
|
-
buffer << [#{name}].pack(
|
249
|
+
buffer << [#{name}].pack(INT32_DECODE_STR)
|
248
250
|
end
|
249
251
|
|
250
252
|
def deserialize_#{name}(buffer)
|
251
|
-
self.#{name}, = buffer.read(4).unpack(
|
253
|
+
self.#{name}, = buffer.read(4).unpack(INT32_DECODE_STR)
|
252
254
|
end
|
253
255
|
RUBY
|
254
256
|
|
@@ -280,7 +282,7 @@ module Moped
|
|
280
282
|
end
|
281
283
|
|
282
284
|
def serialize_#{name}(buffer)
|
283
|
-
buffer << #{name}.pack(
|
285
|
+
buffer << #{name}.pack(INT64_DECODE_ARRAY_STR)
|
284
286
|
end
|
285
287
|
|
286
288
|
def deserialize_#{name}(buffer)
|
@@ -294,11 +296,11 @@ module Moped
|
|
294
296
|
end
|
295
297
|
|
296
298
|
def serialize_#{name}(buffer)
|
297
|
-
buffer << [#{name}].pack(
|
299
|
+
buffer << [#{name}].pack(INT64_DECODE_STR)
|
298
300
|
end
|
299
301
|
|
300
302
|
def deserialize_#{name}(buffer)
|
301
|
-
self.#{name}, = buffer.read(8).unpack(
|
303
|
+
self.#{name}, = buffer.read(8).unpack(INT64_DECODE_STR)
|
302
304
|
end
|
303
305
|
RUBY
|
304
306
|
end
|
data/lib/moped/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moped
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Durran Jordan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-06-
|
12
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bson
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 3.0
|
20
|
+
version: '3.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 3.0
|
27
|
+
version: '3.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: connection_pool
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.4.6
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: A MongoDB driver for Ruby.
|