rabbit_swift 0.3.6 → 0.3.7
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.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/RELEASE.md +6 -0
- data/bin/get_object.rb +5 -2
- data/lib/rabbit_swift/client.rb +3 -2
- data/lib/rabbit_swift/large_object/slo_client.rb +4 -2
- data/lib/rabbit_swift/large_object/static_large_object.rb +1 -0
- data/lib/rabbit_swift/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 310e813c8e2dc70e79b4bf224cbcdd7d99907afd
|
4
|
+
data.tar.gz: da83c59fb0ac14e5d9c96e8d4f9086187c96af48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c827b038e9d582d1c2474ddf1d700d2804baaf758f78e0fb830b6c0b90491811ea155d98f8cb75b419b6516ede821ec7ceeb57d41d54fc5fcfcdafe24f94e74
|
7
|
+
data.tar.gz: ec60ed8e2800ed2898cd18ea2b240bcbd22019a4b556e6783c0dff5bc6e5099ef2cadb76dd008fab209fa339dafaac321d5f708f17818400efd1696e03650703
|
data/README.md
CHANGED
@@ -63,10 +63,9 @@ Or install it yourself as:
|
|
63
63
|
#### SLO Upload Flow
|
64
64
|
1. split file
|
65
65
|
2. upload split files
|
66
|
-
3. create manifest
|
66
|
+
3. create manifest json (to memory)
|
67
67
|
4. upload manifest file
|
68
|
-
5. delete split
|
69
|
-
6. delete manifest file
|
68
|
+
5. delete split file
|
70
69
|
|
71
70
|
### bin utils
|
72
71
|
|
data/RELEASE.md
CHANGED
data/bin/get_object.rb
CHANGED
@@ -44,6 +44,9 @@ response.each do |k, v|
|
|
44
44
|
end
|
45
45
|
|
46
46
|
original_file_md5 = response['Etag']
|
47
|
+
if is_large_object && response.has_key?(RabbitSwift::LargeObject::StaticLargeObject::ORIGINAL_MD5SUM_META_NAME)
|
48
|
+
original_file_md5 = response[RabbitSwift::LargeObject::StaticLargeObject::ORIGINAL_MD5SUM_META_NAME]
|
49
|
+
end
|
47
50
|
|
48
51
|
save_file_path = rabbit_swift_client.get_object(token, url, dest_path)
|
49
52
|
puts save_file_path
|
@@ -63,8 +66,8 @@ else
|
|
63
66
|
end
|
64
67
|
|
65
68
|
|
66
|
-
#when SLO don't check md5.
|
67
|
-
if (!is_large_object)
|
69
|
+
#when SLO don't check md5.
|
70
|
+
if (!is_large_object || response.has_key?(RabbitSwift::LargeObject::StaticLargeObject::ORIGINAL_MD5SUM_META_NAME))
|
68
71
|
save_file_md5 = Digest::MD5.file(save_file_path).to_s
|
69
72
|
puts original_file_md5 + ' --> original_file_md5'
|
70
73
|
puts save_file_md5 + ' --> save_file_md5'
|
data/lib/rabbit_swift/client.rb
CHANGED
@@ -192,7 +192,7 @@ module RabbitSwift
|
|
192
192
|
@res.status
|
193
193
|
end
|
194
194
|
|
195
|
-
def upload_manifest(token, end_point, dest_container,input_file_path, manifest_json)
|
195
|
+
def upload_manifest(token, end_point, dest_container,input_file_path, manifest_json, original_file_md5sum)
|
196
196
|
#相対パスがきた時のために絶対パスに変換
|
197
197
|
path_name_obj = Pathname.new(input_file_path);
|
198
198
|
file_path = path_name_obj.expand_path.to_s
|
@@ -208,7 +208,8 @@ module RabbitSwift
|
|
208
208
|
{'X-Auth-Token' => token,
|
209
209
|
'X-Object-Manifest' => manifest_path+'_',
|
210
210
|
'X-STATIC-LARGE-OBJECT' => true,
|
211
|
-
'Content-Type' => 'application/json'
|
211
|
+
'Content-Type' => 'application/json',
|
212
|
+
LargeObject::StaticLargeObject::ORIGINAL_MD5SUM_META_NAME => original_file_md5sum
|
212
213
|
}
|
213
214
|
http_client = HTTPClient.new
|
214
215
|
url = URI.parse(URI.encode(target_url + '?multipart-manifest=put'))
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'rabbit_swift'
|
2
|
+
require 'digest/md5'
|
2
3
|
|
3
4
|
module RabbitSwift::LargeObject
|
4
5
|
class Slo_client
|
5
6
|
|
6
|
-
attr_accessor :rabbit_swift_client, :src_path, :dest_path, :original_dest_path, :slo_option
|
7
|
+
attr_accessor :rabbit_swift_client, :src_path, :dest_path, :original_dest_path, :slo_option, :original_file_md5sum
|
7
8
|
|
8
9
|
def initialize(rabbit_swift_client, src_path, dest_path, slo_option = {})
|
9
10
|
@rabbit_swift_client = rabbit_swift_client
|
@@ -17,6 +18,7 @@ module RabbitSwift::LargeObject
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def upload
|
21
|
+
original_file_md5sum = Digest::MD5.file(src_path).to_s
|
20
22
|
if @slo_option.has_key?('limit_file_size')
|
21
23
|
slo = RabbitSwift::LargeObject::StaticLargeObject.new(src_path, dest_path, limit_file_size: @slo_option['limit_file_size'])
|
22
24
|
else
|
@@ -46,7 +48,7 @@ module RabbitSwift::LargeObject
|
|
46
48
|
|
47
49
|
puts "dest_path->" + dest_path
|
48
50
|
#マニフェストをアップロード
|
49
|
-
rabbit_swift_client.upload_manifest(token, dest_path, @original_dest_path, @src_path, manifest_json)
|
51
|
+
rabbit_swift_client.upload_manifest(token, dest_path, @original_dest_path, @src_path, manifest_json, original_file_md5sum)
|
50
52
|
|
51
53
|
#分割したファイルを削除
|
52
54
|
rabbit_file_split.delete_all
|
@@ -6,6 +6,7 @@ module RabbitSwift::LargeObject
|
|
6
6
|
class StaticLargeObject
|
7
7
|
|
8
8
|
LIMIT_FILE_SIZE = 5368709120;
|
9
|
+
ORIGINAL_MD5SUM_META_NAME = 'X-Object-Meta-Original-File-Md5sum'
|
9
10
|
|
10
11
|
# 参考 http://blog.bit-isle.jp/bird/2013/06/35
|
11
12
|
# Swift Server SLO https://github.com/openstack/swift/blob/7a9a0e14b1c6a8f51454379beac95cd594a4193b/swift/common/middleware/slo.py
|
data/lib/rabbit_swift/version.rb
CHANGED