right_aws 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -71,7 +71,6 @@ Initial release.
71
71
 
72
72
  * r1983, konstantin, 2007-10-25 22:33:00 +0400
73
73
  * Fixed ActiveSupport requirement bug (thanks to Toby)
74
- * Fixed HttpConnection logging to stdout bug (thanks to Toby)
75
74
 
76
75
  == 1.4.4
77
76
 
@@ -139,6 +138,21 @@ r2963 | todd | 2008-03-06 19:10:23 -0800 (Thu, 06 Mar 2008) | 3 lines
139
138
  in
140
139
  certain rare conditions
141
140
 
141
+ == 1.6.2 2008-03-19
142
+ ------------------------------------------------------------------------
143
+ r3128 | todd | 2008-03-19 11:54:53 -0700 (Wed, 19 Mar 2008) | 2 lines
144
+
145
+ Create 1.6.2 release branch
146
+
147
+ ------------------------------------------------------------------------
148
+ r3130 | todd | 2008-03-19 12:01:12 -0700 (Wed, 19 Mar 2008) | 3 lines
149
+
150
+ Apply Change 3124 to release_1_6_2 : further fixes to
151
+ incrementally_list_bucket
152
+
153
+ ------------------------------------------------------------------------
154
+ r3134 | todd | 2008-03-19 14:10:25 -0700 (Wed, 19 Mar 2008) | 2 lines
142
155
 
156
+ Merge 3133 (max-keys fix in incrementally_list_bucket) from trunk to 1.6.2
143
157
 
144
158
 
data/lib/right_aws.rb CHANGED
@@ -52,7 +52,7 @@ module RightAws #:nodoc:
52
52
  module VERSION #:nodoc:
53
53
  MAJOR = 1
54
54
  MINOR = 6
55
- TINY = 1
55
+ TINY = 2
56
56
 
57
57
  STRING = [MAJOR, MINOR, TINY].join('.')
58
58
  end
@@ -283,27 +283,38 @@ module RightAws
283
283
  response = request_info(req_hash, S3ImprovedListBucketParser.new(:logger => @logger))
284
284
  there_are_more_keys = response[:is_truncated]
285
285
  if(there_are_more_keys)
286
- if(response[:next_marker])
287
- # Dup from response so that no one can mess with these values in the
288
- # yield block
289
- internal_options[:marker] = response[:next_marker].dup
290
- else
291
- if( response[:contents].last[:key] > response[:common_prefixes].last )
292
- internal_options[:marker] = response[:contents].last[:key].dup
293
- else
294
- internal_options[:marker] = response[:common_prefixes].last.dup
295
- end
296
- end
286
+ internal_options[:marker] = decide_marker(response)
297
287
  total_results = response[:contents].length + response[:common_prefixes].length
298
288
  internal_options[:'max-keys'] ? (internal_options[:'max-keys'] -= total_results) : nil
299
289
  end
300
290
  yield response
301
- end while there_are_more_keys && internal_options[:'max-keys'] > 0
291
+ end while there_are_more_keys && under_max_keys(internal_options)
302
292
  true
303
293
  rescue
304
294
  on_exception
305
295
  end
306
296
 
297
+
298
+ private
299
+ def decide_marker(response)
300
+ return response[:next_marker].dup if response[:next_marker]
301
+ last_key = response[:contents].last[:key]
302
+ last_prefix = response[:common_prefixes].last
303
+ if(!last_key)
304
+ return nil if(!last_prefix)
305
+ last_prefix.dup
306
+ elsif(!last_prefix)
307
+ last_key.dup
308
+ else
309
+ last_key > last_prefix ? last_key.dup : last_prefix.dup
310
+ end
311
+ end
312
+
313
+ def under_max_keys(internal_options)
314
+ internal_options[:'max-keys'] ? internal_options[:'max-keys'] > 0 : true
315
+ end
316
+
317
+ public
307
318
  # Saves object to Amazon. Returns +true+ or an exception.
308
319
  # Any header starting with AMAZON_METADATA_PREFIX is considered
309
320
  # user metadata. It will be stored with the object and returned
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: right_aws
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.6.1
7
- date: 2008-03-14 00:00:00 -07:00
6
+ version: 1.6.2
7
+ date: 2008-03-19 00:00:00 -07:00
8
8
  summary: Interface classes for the Amazon EC2, SQS, and S3 Web Services
9
9
  require_paths:
10
10
  - lib