azure-contrib 0.0.3 → 0.0.4

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: 59524c3c741127e9245d85ccec4ec4cd9f03fce4
4
- data.tar.gz: 6dbcae31f84dea2d866683b45ddd7f2c36293d55
3
+ metadata.gz: f3408ec217379118490c2b1bbdbb5533867147f0
4
+ data.tar.gz: 292322bf83ed08ca6fcde67cf4121443ce9c32a2
5
5
  SHA512:
6
- metadata.gz: c078b3c1a21432ab1c5a005d71d4e670993f04584da898f107271c5c7f7e9f43d4fa8d053aa41c59cb9666be45bd078b2ffbae796dcf3d2bc121741acbf21a24
7
- data.tar.gz: 6eff77bffe8cb298521f03003db4003fd65b6b82bbc52e3b36a2e5ebee1fac2cf5338a262b85c1ff8bd0f6912b28f19cef1aeea0fbc2e5cfecec42ac90ecc8aa
6
+ metadata.gz: 21affeb234d163474e4574651be05e3006171f14283d4677b5a554d9345062e747eb08fe17a67d0bc007a2e7ada39692792b841cc7b882eb002eb84e05e40a58
7
+ data.tar.gz: 765ac7f5785440d9da055912709797333e73cba0e025a37b16cd0562cbea1fffde69d23bdce6d0a64b2e14fdbcc3036197b49fafced98f7fe733e6fd1076de4a
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  *.iml
19
19
  *.idea
20
+ .rakeTasks
data/README.md CHANGED
@@ -19,7 +19,7 @@ And then execute:
19
19
 
20
20
  ## Usage
21
21
 
22
- Its a start
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 )
@@ -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] || 60){
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
- return false unless block_list
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: 20, args: [self, container, blob, options])
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|
@@ -1,5 +1,5 @@
1
1
  module Azure
2
2
  module Contrib
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
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.3
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-07 00:00:00.000000000 Z
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