aws-sdk-s3 1.184.0 → 1.188.0

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.
@@ -43,7 +43,7 @@ module Aws
43
43
  when 'get_range'
44
44
  if @chunk_size
45
45
  resp = @client.head_object(@params)
46
- multithreaded_get_by_ranges(resp.content_length)
46
+ multithreaded_get_by_ranges(resp.content_length, resp.etag)
47
47
  else
48
48
  msg = 'In :get_range mode, :chunk_size must be provided'
49
49
  raise ArgumentError, msg
@@ -71,7 +71,7 @@ module Aws
71
71
  if resp.content_length <= MIN_CHUNK_SIZE
72
72
  single_request
73
73
  else
74
- multithreaded_get_by_ranges(resp.content_length)
74
+ multithreaded_get_by_ranges(resp.content_length, resp.etag)
75
75
  end
76
76
  else
77
77
  # partNumber is an option
@@ -79,18 +79,18 @@ module Aws
79
79
  if resp.content_length <= MIN_CHUNK_SIZE
80
80
  single_request
81
81
  else
82
- compute_mode(resp.content_length, count)
82
+ compute_mode(resp.content_length, count, resp.etag)
83
83
  end
84
84
  end
85
85
  end
86
86
 
87
- def compute_mode(file_size, count)
87
+ def compute_mode(file_size, count, etag)
88
88
  chunk_size = compute_chunk(file_size)
89
89
  part_size = (file_size.to_f / count.to_f).ceil
90
90
  if chunk_size < part_size
91
- multithreaded_get_by_ranges(file_size)
91
+ multithreaded_get_by_ranges(file_size, etag)
92
92
  else
93
- multithreaded_get_by_parts(count, file_size)
93
+ multithreaded_get_by_parts(count, file_size, etag)
94
94
  end
95
95
  end
96
96
 
@@ -122,7 +122,7 @@ module Aws
122
122
  chunks.each_slice(@thread_count).to_a
123
123
  end
124
124
 
125
- def multithreaded_get_by_ranges(file_size)
125
+ def multithreaded_get_by_ranges(file_size, etag)
126
126
  offset = 0
127
127
  default_chunk_size = compute_chunk(file_size)
128
128
  chunks = []
@@ -134,7 +134,7 @@ module Aws
134
134
  chunks << Part.new(
135
135
  part_number: part_number,
136
136
  size: (progress-offset),
137
- params: @params.merge(range: range)
137
+ params: @params.merge(range: range, if_match: etag)
138
138
  )
139
139
  part_number += 1
140
140
  offset = progress
@@ -142,9 +142,9 @@ module Aws
142
142
  download_in_threads(PartList.new(chunks), file_size)
143
143
  end
144
144
 
145
- def multithreaded_get_by_parts(n_parts, total_size)
145
+ def multithreaded_get_by_parts(n_parts, total_size, etag)
146
146
  parts = (1..n_parts).map do |part|
147
- Part.new(part_number: part, params: @params.merge(part_number: part))
147
+ Part.new(part_number: part, params: @params.merge(part_number: part, if_match: etag))
148
148
  end
149
149
  download_in_threads(PartList.new(parts), total_size)
150
150
  end
@@ -397,11 +397,17 @@ module Aws::S3
397
397
  end
398
398
 
399
399
  # If present, indicates that the requester was successfully charged for
400
- # the request.
400
+ # the request. For more information, see [Using Requester Pays buckets
401
+ # for storage transfers and usage][1] in the *Amazon Simple Storage
402
+ # Service user guide*.
401
403
  #
402
404
  # <note markdown="1"> This functionality is not supported for directory buckets.
403
405
  #
404
406
  # </note>
407
+ #
408
+ #
409
+ #
410
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RequesterPaysBuckets.html
405
411
  # @return [String]
406
412
  def request_charged
407
413
  data[:request_charged]
@@ -55,11 +55,17 @@ module Aws::S3
55
55
  end
56
56
 
57
57
  # If present, indicates that the requester was successfully charged for
58
- # the request.
58
+ # the request. For more information, see [Using Requester Pays buckets
59
+ # for storage transfers and usage][1] in the *Amazon Simple Storage
60
+ # Service user guide*.
59
61
  #
60
62
  # <note markdown="1"> This functionality is not supported for directory buckets.
61
63
  #
62
64
  # </note>
65
+ #
66
+ #
67
+ #
68
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RequesterPaysBuckets.html
63
69
  # @return [String]
64
70
  def request_charged
65
71
  data[:request_charged]
@@ -62,18 +62,16 @@ module Aws
62
62
  class Handler < Seahorse::Client::Handler
63
63
 
64
64
  def call(context)
65
- target = context.params[:response_target] || context[:response_target]
66
-
67
65
  # retry is only supported when range is NOT set on the initial request
68
- if supported_target?(target) && !context.params[:range]
69
- add_event_listeners(context, target)
66
+ if supported_target?(context) && !context.params[:range]
67
+ add_event_listeners(context)
70
68
  end
71
69
  @handler.call(context)
72
70
  end
73
71
 
74
72
  private
75
73
 
76
- def add_event_listeners(context, target)
74
+ def add_event_listeners(context)
77
75
  context.http_response.on_headers(200..299) do
78
76
  case context.http_response.body
79
77
  when Seahorse::Client::BlockIO then
@@ -123,8 +121,8 @@ module Aws
123
121
  context.http_response.body.is_a?(RetryableManagedFile)
124
122
  end
125
123
 
126
- def supported_target?(target)
127
- case target
124
+ def supported_target?(context)
125
+ case context[:response_target]
128
126
  when Proc, String, Pathname then true
129
127
  else false
130
128
  end