azure-contrib 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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +17 -1
- data/lib/azure/blob_service.rb +6 -3
- data/lib/azure/contrib/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3408ec217379118490c2b1bbdbb5533867147f0
|
4
|
+
data.tar.gz: 292322bf83ed08ca6fcde67cf4121443ce9c32a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21affeb234d163474e4574651be05e3006171f14283d4677b5a554d9345062e747eb08fe17a67d0bc007a2e7ada39692792b841cc7b882eb002eb84e05e40a58
|
7
|
+
data.tar.gz: 765ac7f5785440d9da055912709797333e73cba0e025a37b16cd0562cbea1fffde69d23bdce6d0a64b2e14fdbcc3036197b49fafced98f7fe733e6fd1076de4a
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -19,7 +19,7 @@ And then execute:
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
|
22
|
+
### Shared Access Signatures
|
23
23
|
|
24
24
|
```ruby
|
25
25
|
|
@@ -35,6 +35,22 @@ signed_uri = signer.sign
|
|
35
35
|
|
36
36
|
```
|
37
37
|
|
38
|
+
### Chunked Uploads
|
39
|
+
|
40
|
+
For files > 64MB you will need chunk your uploads. While the Azure Ruby SDK does provide the methods for doing this, the process of chunking is fiddly and requires a great deal of supporting code.
|
41
|
+
|
42
|
+
This gem overrides the `create_block_blob` to add chunking support.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
container = <your container name>
|
46
|
+
blob = <your blob name>
|
47
|
+
|
48
|
+
service = Azure::BlobService.new
|
49
|
+
service.create_block_blob(container, blob, 'path/to/file', chunking: true)
|
50
|
+
```
|
51
|
+
|
52
|
+
All options like `:timeout` may still be passed as usual. Without the `chunking: true` option, the original method is called untouched.
|
53
|
+
|
38
54
|
## Contributing
|
39
55
|
|
40
56
|
1. Fork it ( http://github.com/<my-github-username>/azure-contrib/fork )
|
data/lib/azure/blob_service.rb
CHANGED
@@ -22,7 +22,7 @@ class BlockActor
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def upload(block_id, chunk, retries = 0)
|
25
|
-
Timeout::timeout(@options[:timeout] ||
|
25
|
+
Timeout::timeout(@options[:timeout] || 30){
|
26
26
|
log "Uploading block #{block_id}"
|
27
27
|
options = @options.dup
|
28
28
|
options[:content_md5] = Base64.strict_encode64(Digest::MD5.digest(chunk))
|
@@ -53,7 +53,10 @@ module Azure
|
|
53
53
|
filepath = content_or_filepath
|
54
54
|
block_list = upload_chunks(container, blob, filepath, options)
|
55
55
|
|
56
|
-
|
56
|
+
unless block_list
|
57
|
+
puts "EMPTY BLOCKLIST!"
|
58
|
+
return false
|
59
|
+
end
|
57
60
|
|
58
61
|
puts "Done uploading #{block_list.size} blocks, committing ..."
|
59
62
|
options[:blob_content_type] = options[:content_type]
|
@@ -70,7 +73,7 @@ module Azure
|
|
70
73
|
def upload_chunks(container, blob, filepath, options = {})
|
71
74
|
counter = 1
|
72
75
|
futures = []
|
73
|
-
pool = BlockActor.pool(size:
|
76
|
+
pool = BlockActor.pool(size: 10, args: [self, container, blob, options])
|
74
77
|
|
75
78
|
open(filepath, 'rb') do |f|
|
76
79
|
f.each_chunk() {|chunk|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azure-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Michael
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -107,7 +107,6 @@ files:
|
|
107
107
|
- README.md
|
108
108
|
- Rakefile
|
109
109
|
- azure-contrib.gemspec
|
110
|
-
- azure-contrib.iml
|
111
110
|
- lib/azure/blob_service.rb
|
112
111
|
- lib/azure/contrib.rb
|
113
112
|
- lib/azure/contrib/auth/shared_access_signature.rb
|