moped 2.0.0.beta6 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of moped might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39c9d2378a1f97c2508d5dff1f4bbda4a8ca5a90
4
- data.tar.gz: f64b98eb765c0c85e1fbd9385e01242d2ef93b14
3
+ metadata.gz: 1e27dd83942aed9990d21b24629368d8722ea13b
4
+ data.tar.gz: 8cd20ee40200cda5f92ccb71858e2ccd4f6fc86f
5
5
  SHA512:
6
- metadata.gz: 7ca3aea553f4b746bd7052ad435c5a8ea5a1882296c62f47a3bb88a1288283fded424a63332100fa2ae2163ceafb823de7e0f91763f23889a48706469d63cdd4
7
- data.tar.gz: b6e7973b2c424f5a63508f6dba9ce81f476016d2cbe6adf21f02055bf675d6561691e184d5568c131b31ad014a890818d0b12b3b192e8cc5a3849c0d805fd507
6
+ metadata.gz: e82c6b80baf9514433d07ce31092f796d95c00f0140b70ff7f944eae44a7e42d0fa0b0e9e7ab00a0d89769db76638402666760a2c301f1121e01f4cf2ad56ab9
7
+ data.tar.gz: 1237a981a4cd95709c73f764cf5d851ccf24843301d9f9bea9e9a32fc9bf79272230cc0b9a04b1e411ad3ef47b71ce78db4621517cb29533d599d5eef35da19f
data/lib/moped/address.rb CHANGED
@@ -56,7 +56,7 @@ module Moped
56
56
  raise Resolv::ResolvError unless @ip
57
57
  end
58
58
  @resolved ||= "#{ip}:#{port}"
59
- rescue Timeout::Error, Resolv::ResolvError
59
+ rescue Timeout::Error, Resolv::ResolvError, SocketError
60
60
  Loggable.warn(" MOPED:", "Could not resolve IP for: #{original}", "n/a")
61
61
  node.down! and false
62
62
  end
@@ -23,9 +23,7 @@ module Moped
23
23
  # @return [ String ] The port the connection connects on.
24
24
  # @!attribute timeout
25
25
  # @return [ Integer ] The timeout in seconds.
26
- # @!attribute last_use
27
- # @return [ Time ] The time the connection was last checked out.
28
- attr_reader :host, :options, :port, :timeout, :last_use
26
+ attr_reader :host, :options, :port, :timeout
29
27
 
30
28
  # Is the connection alive?
31
29
  #
@@ -101,46 +99,9 @@ module Moped
101
99
  @timeout = timeout
102
100
  @options = options
103
101
  @sock = nil
104
- @last_use = nil
105
102
  @request_id = 0
106
103
  end
107
104
 
108
- # Expiring a connection means returning it to the connection pool.
109
- #
110
- # @example Expire the connection.
111
- # connection.expire
112
- #
113
- # @return [ nil ] nil.
114
- #
115
- # @since 2.0.0
116
- def expire
117
- @last_use = nil
118
- end
119
-
120
- # An expired connection is not currently being used.
121
- #
122
- # @example Is the connection expired?
123
- # connection.expired?
124
- #
125
- # @return [ true, false ] If the connection is expired.
126
- #
127
- # @since 2.0.0
128
- def expired?
129
- @last_use.nil?
130
- end
131
-
132
- # A leased connection is currently checkout out from the connection pool.
133
- #
134
- # @example Lease the connection.
135
- # connection.lease
136
- #
137
- # @return [ Time ] The current time of leasing.
138
- #
139
- # @since 2.0.0
140
- def lease
141
- @last_use = Time.now
142
- end
143
-
144
105
  # Read from the connection.
145
106
  #
146
107
  # @example Read from the connection.
@@ -117,15 +117,7 @@ module Moped
117
117
  # @since 1.0.0
118
118
  def handle_socket_errors
119
119
  yield
120
- rescue Errno::ECONNREFUSED => e
121
- raise Errors::ConnectionFailure, generate_message(e)
122
- rescue Errno::EHOSTUNREACH => e
123
- raise Errors::ConnectionFailure, generate_message(e)
124
- rescue Errno::EPIPE => e
125
- raise Errors::ConnectionFailure, generate_message(e)
126
- rescue Errno::ECONNRESET => e
127
- raise Errors::ConnectionFailure, generate_message(e)
128
- rescue Errno::ETIMEDOUT => e
120
+ rescue SystemCallError => e
129
121
  raise Errors::ConnectionFailure, generate_message(e)
130
122
  rescue IOError
131
123
  raise Errors::ConnectionFailure, "Connection timed out to Mongo on #{host}:#{port}"
data/lib/moped/query.rb CHANGED
@@ -173,6 +173,42 @@ module Moped
173
173
  self
174
174
  end
175
175
 
176
+ # Specify the inclusive lower bound for a specific index in order to
177
+ # constrain the results of find(). min() provides a way to specify lower
178
+ # bounds on compound key indexes.
179
+ #
180
+ # @example Set the lower bond on the age index to 21 years
181
+ # (provided the collection has a {"age" => 1} index)
182
+ # db[:people].find.min("age" => 21)
183
+ #
184
+ # @param [ Hash ] indexBounds The inclusive lower bound for the index keys.
185
+ #
186
+ # @return [ Query ] self
187
+ #
188
+ def min(index_bounds)
189
+ upgrade_to_advanced_selector
190
+ operation.selector["$min"] = index_bounds
191
+ self
192
+ end
193
+
194
+ # Specifies the exclusive upper bound for a specific index in order to
195
+ # constrain the results of find(). max() provides a way to specify an
196
+ # upper bound on compound key indexes.
197
+ #
198
+ # @example Set the upper bond on the age index to 21 years
199
+ # (provided the collection has a {"age" => -11} index)
200
+ # db[:people].find.min("age" => 21)
201
+ #
202
+ # @param [ Hash ] indexBounds The exclusive upper bound for the index keys.
203
+ #
204
+ # @return [ Query ] self
205
+ #
206
+ def max(index_bounds)
207
+ upgrade_to_advanced_selector
208
+ operation.selector["$max"] = index_bounds
209
+ self
210
+ end
211
+
176
212
  # Initialize the query.
177
213
  #
178
214
  # @example Initialize the query.
data/lib/moped/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Moped
3
- VERSION = "2.0.0.beta6"
3
+ VERSION = "2.0.0.rc1"
4
4
  end
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.0.beta6
4
+ version: 2.0.0.rc1
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: 2014-02-01 00:00:00.000000000 Z
12
+ date: 2014-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.2'
34
+ version: '2.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.2'
41
+ version: '2.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: optionable
44
44
  requirement: !ruby/object:Gem::Requirement