swift-storage 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +11 -0
- data/lib/swift_storage/node.rb +2 -1
- data/lib/swift_storage/object.rb +5 -3
- data/lib/swift_storage/service.rb +2 -1
- data/lib/swift_storage/version.rb +1 -1
- 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: 4df7d503d429d4016d37c4fd440d39eed1c4b30d
|
4
|
+
data.tar.gz: 66bb39377d3493c4d028c2d166c686c1e5da8821
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b850b928deca95b0ac052c49a19c905ca229d1832fdeb86b83157f2564b05cd15d9f1455f5578ad41d687cbeba3bc0e20484db141ccaeb4721a9a1ab5e43c7c6
|
7
|
+
data.tar.gz: caac9b19dd0788d241d934d65d76545765a7d1de06217bddda83d1fb77e50208ad5052d7f6a1b87603a3442bfeff54832ff66eb2e0c418bc8d5f13b0c9c3d872
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
This file is written in reverse chronological order, newer releases will
|
4
4
|
appear at the top.
|
5
5
|
|
6
|
+
## 0.0.9
|
7
|
+
|
8
|
+
* Allow upload of large file (>5GB)
|
9
|
+
[#9](https://github.com/memoways/swift-ruby/pull/10)
|
10
|
+
@ArmandPredicSis
|
11
|
+
|
6
12
|
## 0.0.8
|
7
13
|
|
8
14
|
* Check token expiration
|
data/README.md
CHANGED
@@ -83,6 +83,16 @@ File.open('/tmp/Kessel.asteroid', 'r') do |input|
|
|
83
83
|
source_obj.write(input, content_type: 'application/spice')
|
84
84
|
end
|
85
85
|
|
86
|
+
# Upload data larger than 5GB
|
87
|
+
# 1/ Split file larger than 5GB into subfiles, for example:
|
88
|
+
system("split -a 5 -d -b size file_path result_path")
|
89
|
+
# 2/ upload each part:
|
90
|
+
File.open(result_path) do |input|
|
91
|
+
source_obj.write(input, content_type: 'application/txt', part_location: 'container/object/part_number')
|
92
|
+
end
|
93
|
+
# 3/ Create a manifest
|
94
|
+
source_obj.write(object_manifest: 'container/object/')
|
95
|
+
|
86
96
|
# Copy an object
|
87
97
|
# Source can be a SwiftStorage::Object or a string like 'source/Kessel.asteroid'
|
88
98
|
destination_obj.copy_from(source_obj)
|
@@ -116,3 +126,4 @@ p destination_obj.temp_url(Time.now + (3600 * 10), method: :get)
|
|
116
126
|
|
117
127
|
- Nicolas Goy @kuon
|
118
128
|
- @mdouchement
|
129
|
+
- @ArmandPredicSis
|
data/lib/swift_storage/node.rb
CHANGED
data/lib/swift_storage/object.rb
CHANGED
@@ -116,13 +116,14 @@ class SwiftStorage::Object < SwiftStorage::Node
|
|
116
116
|
cache_control: nil,
|
117
117
|
expires: nil,
|
118
118
|
object_manifest: nil,
|
119
|
+
part_location: nil,
|
119
120
|
metadata: nil)
|
120
121
|
|
121
122
|
h = {}
|
122
123
|
|
123
124
|
input_stream.nil? or content_type or raise ArgumentError, 'Content_type is required if input_stream is given'
|
124
125
|
|
125
|
-
object_manifest.nil? or input_stream.nil? or raise ArgumentError, 'Input must be nil on object
|
126
|
+
object_manifest.nil? or input_stream.nil? or raise ArgumentError, 'Input must be nil on object manifest'
|
126
127
|
|
127
128
|
if expires == :never
|
128
129
|
expires = Time.at(4_000_000_000)
|
@@ -144,8 +145,9 @@ class SwiftStorage::Object < SwiftStorage::Node
|
|
144
145
|
merge_metadata(h, metadata)
|
145
146
|
|
146
147
|
method = input_stream || object_manifest ? :put : :post
|
148
|
+
path = part_location || relative_path
|
147
149
|
|
148
|
-
request(
|
150
|
+
request(path,
|
149
151
|
:method => method,
|
150
152
|
:headers => h,
|
151
153
|
:input_stream => input_stream)
|
@@ -173,7 +175,7 @@ class SwiftStorage::Object < SwiftStorage::Node
|
|
173
175
|
raise ArgumentError.new('Invalid source type')
|
174
176
|
end
|
175
177
|
|
176
|
-
request(path, method: :copy, headers: optional_headers.merge(H::DESTINATION => relative_path))
|
178
|
+
request(path + '?multipart-manifest=get', method: :copy, headers: optional_headers.merge(H::DESTINATION => relative_path))
|
177
179
|
self
|
178
180
|
end
|
179
181
|
|
@@ -127,8 +127,9 @@ class SwiftStorage::Service
|
|
127
127
|
|
128
128
|
# Cache HTTP session as url with no path (scheme, host, port)
|
129
129
|
uri = URI.parse(URI.escape path_or_url)
|
130
|
-
path = uri.path
|
130
|
+
path = uri.query ? uri.path + '?' + uri.query : uri.path
|
131
131
|
uri.path = ''
|
132
|
+
uri.query = nil
|
132
133
|
key = uri.to_s
|
133
134
|
|
134
135
|
if sessions[key].nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swift-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Goy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|