miasma-aws 0.1.12 → 0.1.14
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/miasma-aws/version.rb +1 -1
- data/lib/miasma/contrib/aws/storage.rb +30 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73b61343ba58ba168a4374d7a27ebccf03be0755
|
4
|
+
data.tar.gz: 4a0890aae5f14b0fe5199aca62993698f92b7404
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8760d6337a22a3575ae9f95aa4a658b84138c790fa933250630b48791630223de8d0cfbc0ca1ae792da71c66d4b83c5507a31b88f779bdaaebfa73d3145c71ff
|
7
|
+
data.tar.gz: 61df3b1d4b30f7500bba01565bb0158276cafcb8d4b0ae4bd500a68a495168d1cd32c9571f157c92c89c3d9f39f291f83135869ad48e93912a3e20e3c5bfa1f6
|
data/CHANGELOG.md
CHANGED
data/lib/miasma-aws/version.rb
CHANGED
@@ -15,6 +15,33 @@ module Miasma
|
|
15
15
|
include Contrib::AwsApiCore::ApiCommon
|
16
16
|
include Contrib::AwsApiCore::RequestUtils
|
17
17
|
|
18
|
+
# Fetch all results when tokens are being used
|
19
|
+
# for paging results
|
20
|
+
#
|
21
|
+
# @param next_token [String]
|
22
|
+
# @param result_key [Array<String, Symbol>] path to result
|
23
|
+
# @yield block to perform request
|
24
|
+
# @yieldparam options [Hash] request parameters (token information)
|
25
|
+
# @return [Array]
|
26
|
+
# @note this is customized to S3 since its API is slightly
|
27
|
+
# different than the usual token based fetching
|
28
|
+
def all_result_pages(next_token, *result_key, &block)
|
29
|
+
list = []
|
30
|
+
options = next_token ? Smash.new('marker' => next_token) : Smash.new
|
31
|
+
result = block.call(options)
|
32
|
+
content = result.get(*result_key.dup)
|
33
|
+
if(content.is_a?(Array))
|
34
|
+
list += content
|
35
|
+
else
|
36
|
+
list << content
|
37
|
+
end
|
38
|
+
set = result.get(*result_key.slice(0, 2))
|
39
|
+
if(set.is_a?(Hash) && set['IsTruncated'] && set['Contents'])
|
40
|
+
list += all_result_pages(set['Contents'].last['Key'], *result_key, &block)
|
41
|
+
end
|
42
|
+
list.compact
|
43
|
+
end
|
44
|
+
|
18
45
|
# Simple init override to force HOST and adjust region for
|
19
46
|
# signatures if required
|
20
47
|
def initialize(args)
|
@@ -222,7 +249,7 @@ module Miasma
|
|
222
249
|
count = 1
|
223
250
|
parts = []
|
224
251
|
file.body.rewind
|
225
|
-
while(content = file.body.read(Storage::READ_BODY_CHUNK_SIZE))
|
252
|
+
while(content = file.body.read(Storage::READ_BODY_CHUNK_SIZE * 1.5))
|
226
253
|
parts << [
|
227
254
|
count,
|
228
255
|
request(
|
@@ -231,7 +258,7 @@ module Miasma
|
|
231
258
|
:endpoint => bucket_endpoint(file.bucket),
|
232
259
|
:headers => Smash.new(
|
233
260
|
'Content-Length' => content.size,
|
234
|
-
'Content-MD5' =>
|
261
|
+
'Content-MD5' => Digest::MD5.base64digest(content)
|
235
262
|
),
|
236
263
|
:params => Smash.new(
|
237
264
|
'partNumber' => count,
|
@@ -266,7 +293,7 @@ module Miasma
|
|
266
293
|
:body => complete
|
267
294
|
)
|
268
295
|
file.etag = result.get(:body, 'CompleteMultipartUploadResult', 'ETag')
|
269
|
-
rescue
|
296
|
+
rescue => e
|
270
297
|
request(
|
271
298
|
:method => :delete,
|
272
299
|
:path => file_path(file),
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miasma-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: miasma
|