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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48dc8b6b27a0f5b16dd2e4e7cac42a82e37df57a
4
- data.tar.gz: 3c8502e2018f7fdefe1d2a1966f96f68e2ec5ad6
3
+ metadata.gz: 4df7d503d429d4016d37c4fd440d39eed1c4b30d
4
+ data.tar.gz: 66bb39377d3493c4d028c2d166c686c1e5da8821
5
5
  SHA512:
6
- metadata.gz: 7aebfa7fe5e7a14d70ea68faa435d3002ca8d6bc17112ae808dcdd38c756c0d8ef4c4a9d48a4aa2b369a3ad6c28c15a22cf3d4b3f8a6e78f1000a96dde867d57
7
- data.tar.gz: af225f4c2807e0582aa1a13d5fcb451f8e271dd83ecb91789d8ad622ec39c8c76bc9335fa907f12c3fa2a90b44d174310cbd550341b07a0a31bc696906dc7e39
6
+ metadata.gz: b850b928deca95b0ac052c49a19c905ca229d1832fdeb86b83157f2564b05cd15d9f1455f5578ad41d687cbeba3bc0e20484db141ccaeb4721a9a1ab5e43c7c6
7
+ data.tar.gz: caac9b19dd0788d241d934d65d76545765a7d1de06217bddda83d1fb77e50208ad5052d7f6a1b87603a3442bfeff54832ff66eb2e0c418bc8d5f13b0c9c3d872
@@ -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
@@ -83,7 +83,8 @@ class SwiftStorage::Node
83
83
  end
84
84
 
85
85
  def exists?
86
- request(relative_path, :method => :head) && true
86
+ request(relative_path, :method => :head)
87
+ true
87
88
  rescue SwiftStorage::Errors::NotFoundError
88
89
  false
89
90
  end
@@ -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 manigest'
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(relative_path,
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?
@@ -1,3 +1,3 @@
1
1
  module SwiftStorage
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.8
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-25 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler