rest-ftp-daemon 1.0.11 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile.lock +1 -1
- data/lib/rest-ftp-daemon/helpers/transfer.rb +18 -9
- data/lib/rest-ftp-daemon/location.rb +2 -2
- data/lib/rest-ftp-daemon/remote/s3.rb +7 -4
- data/rest-ftp-daemon.gemspec +3 -3
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 961988d79a575ba64689ce029245e8d7401e2cd1
|
4
|
+
data.tar.gz: fce27523beeec66ba8e9e72b91d39b8e483dacf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f743508d26964d51f49787f45a8d89264146bc723c4646c250cff97515a3a158dc4688c97c50d9c538ee6258b67f2a5f93392f9ffc193c8315c9f1136d32cd
|
7
|
+
data.tar.gz: 5517d5ec5430dc8db3102b36ad4a79e25162a9d36f6eb57adadd896c08c44df98ea9d568331a4259f063efbf08028d6e1c8a2e38473b1a69377cacc35556e44f
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -39,11 +39,14 @@ module RestFtpDaemon
|
|
39
39
|
global_transfer_bitrate = get_bitrate @transfer_total, (Time.now - transfer_started_at)
|
40
40
|
set_info INFO_TRANFER_BITRATE, global_transfer_bitrate.round(0)
|
41
41
|
|
42
|
+
# Explicitely send a 100% notification
|
43
|
+
progress_notify 100, target.name, true
|
44
|
+
|
42
45
|
# Done
|
43
46
|
set_info INFO_SOURCE_CURRENT, nil
|
44
47
|
end
|
45
48
|
|
46
|
-
def update_progress transferred, name
|
49
|
+
def update_progress transferred, name
|
47
50
|
# Update counters
|
48
51
|
@transfer_sent += transferred
|
49
52
|
set_info INFO_TRANFER_SENT, @transfer_sent
|
@@ -53,14 +56,17 @@ module RestFtpDaemon
|
|
53
56
|
set_info INFO_TRANFER_PROGRESS, percent0
|
54
57
|
|
55
58
|
# Update bitrates
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
if transferred
|
60
|
+
@current_bitrate = running_bitrate @transfer_sent
|
61
|
+
set_info INFO_TRANFER_BITRATE, @current_bitrate.round(0)
|
62
|
+
end
|
63
|
+
# log_debug "update_progress", {
|
64
|
+
# transfer_sent: @transfer_sent,
|
65
|
+
# current_bitrate: @current_bitrate,
|
66
|
+
# }
|
61
67
|
|
62
68
|
# Notify if requested
|
63
|
-
progress_notify
|
69
|
+
progress_notify percent0, name
|
64
70
|
|
65
71
|
# Touch my worker status
|
66
72
|
touch_job
|
@@ -68,13 +74,16 @@ module RestFtpDaemon
|
|
68
74
|
|
69
75
|
private
|
70
76
|
|
71
|
-
def progress_notify
|
77
|
+
def progress_notify percent0, name, force_notify = false
|
78
|
+
# What's current time ?
|
79
|
+
now = Time.now
|
80
|
+
|
72
81
|
# No delay provided ?
|
73
82
|
return if @config[:notify_after].nil?
|
74
83
|
|
75
84
|
# Still too early to notify again ?
|
76
85
|
how_long_ago = (now.to_f - @last_notify_at.to_f)
|
77
|
-
return unless how_long_ago > @config[:notify_after]
|
86
|
+
return unless force_notify || (how_long_ago > @config[:notify_after])
|
78
87
|
|
79
88
|
# # Update bitrates
|
80
89
|
# @current_bitrate = running_bitrate @transfer_sent
|
@@ -97,11 +97,15 @@ module RestFtpDaemon
|
|
97
97
|
body: part,
|
98
98
|
part_number: current_part,
|
99
99
|
})
|
100
|
-
|
101
|
-
|
100
|
+
part_size = part.bytesize
|
101
|
+
log_debug "upload_part [#{current_part}/#{parts_count}] size[#{part_size}]"
|
102
|
+
|
103
|
+
# Push this over there
|
104
|
+
resp = @client.upload_part(opts)
|
102
105
|
|
103
106
|
# Send progress info upwards
|
104
|
-
yield parts_size
|
107
|
+
log_debug "upload_multipart yield parts_size[#{parts_size}] s3_name[#{s3_name}]"
|
108
|
+
yield part_size, s3_name
|
105
109
|
|
106
110
|
# Increment part number
|
107
111
|
current_part += 1
|
@@ -110,7 +114,6 @@ module RestFtpDaemon
|
|
110
114
|
# Retrieve parts and complete upload
|
111
115
|
log_debug "complete_multipart_upload"
|
112
116
|
parts_resp = @client.list_parts(options)
|
113
|
-
|
114
117
|
those_parts = parts_resp.parts.map do |part|
|
115
118
|
{ part_number: part.part_number, etag: part.etag }
|
116
119
|
end
|
data/rest-ftp-daemon.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
|
4
4
|
# Project version
|
5
|
-
spec.version = "1.0.
|
5
|
+
spec.version = "1.0.12"
|
6
6
|
|
7
7
|
# Project description
|
8
8
|
spec.name = "rest-ftp-daemon"
|
9
9
|
spec.authors = ["Bruno MEDICI"]
|
10
10
|
spec.email = "rftpd-project@bmconseil.com"
|
11
|
-
spec.description = "
|
12
|
-
spec.summary = "RESTful
|
11
|
+
spec.description = "A pretty simple transfer daemon, controlled with a RESTful API"
|
12
|
+
spec.summary = "RESTful transfer jobs daemon"
|
13
13
|
spec.homepage = "http://github.com/bmedici/rest-ftp-daemon"
|
14
14
|
spec.licenses = ["MIT"]
|
15
15
|
spec.date = Time.now.strftime("%Y-%m-%d")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-ftp-daemon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno MEDICI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -416,8 +416,7 @@ dependencies:
|
|
416
416
|
- - ">="
|
417
417
|
- !ruby/object:Gem::Version
|
418
418
|
version: '0'
|
419
|
-
description:
|
420
|
-
API
|
419
|
+
description: A pretty simple transfer daemon, controlled with a RESTful API
|
421
420
|
email: rftpd-project@bmconseil.com
|
422
421
|
executables:
|
423
422
|
- rest-ftp-daemon
|
@@ -567,5 +566,5 @@ rubyforge_project:
|
|
567
566
|
rubygems_version: 2.5.1
|
568
567
|
signing_key:
|
569
568
|
specification_version: 4
|
570
|
-
summary: RESTful
|
569
|
+
summary: RESTful transfer jobs daemon
|
571
570
|
test_files: []
|