sluice 0.0.3 → 0.0.4
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.
- data/lib/sluice.rb +1 -1
- data/lib/sluice/storage/s3.rb +11 -5
- metadata +3 -3
data/lib/sluice.rb
CHANGED
data/lib/sluice/storage/s3.rb
CHANGED
@@ -285,7 +285,9 @@ module Sluice
|
|
285
285
|
# Download is a stand-alone operation vs move/copy/delete
|
286
286
|
if operation == :download
|
287
287
|
retry_x(
|
288
|
-
|
288
|
+
Sluice::Storage::S3,
|
289
|
+
[:download_file, s3, file, target],
|
290
|
+
RETRIES,
|
289
291
|
" +/> #{target}",
|
290
292
|
"Problem downloading #{file.key}. Retrying.")
|
291
293
|
end
|
@@ -293,7 +295,9 @@ module Sluice
|
|
293
295
|
# A move or copy starts with a copy file
|
294
296
|
if [:move, :copy].include? operation
|
295
297
|
retry_x(
|
296
|
-
file
|
298
|
+
file,
|
299
|
+
[:copy, to_loc_or_dir.bucket, target],
|
300
|
+
RETRIES,
|
297
301
|
" +-> #{to_loc_or_dir.bucket}/#{target}",
|
298
302
|
"Problem copying #{file.key}. Retrying.")
|
299
303
|
end
|
@@ -301,7 +305,9 @@ module Sluice
|
|
301
305
|
# A move or delete ends with a delete
|
302
306
|
if [:move, :delete].include? operation
|
303
307
|
retry_x(
|
304
|
-
file
|
308
|
+
file,
|
309
|
+
[:destroy],
|
310
|
+
RETRIES,
|
305
311
|
" x #{source}",
|
306
312
|
"Problem destroying #{file.key}. Retrying.")
|
307
313
|
end
|
@@ -323,10 +329,10 @@ module Sluice
|
|
323
329
|
# +retries+:: Number of retries to attempt
|
324
330
|
# +attempt_msg+:: Message to puts on each attempt
|
325
331
|
# +failure_msg+:: Message to puts on each failure
|
326
|
-
def retry_x(
|
332
|
+
def retry_x(object, send_args, retries, attempt_msg, failure_msg)
|
327
333
|
i = 0
|
328
334
|
begin
|
329
|
-
|
335
|
+
object.send(*send_args)
|
330
336
|
puts attempt_msg
|
331
337
|
rescue
|
332
338
|
raise unless i < retries
|
metadata
CHANGED