blobsterix 0.0.13 → 0.0.14

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: 61c63e268a35487d1180f80f6f9865fd0c0cb0e2
4
- data.tar.gz: 648c1525917b0577eb25bcfe5dbc1b7e24df3366
3
+ metadata.gz: f481ca0770aed1210888cb8be44b046d78d42e8d
4
+ data.tar.gz: 2f68e7ca5f0a995c31bc3770a769a843144de8b0
5
5
  SHA512:
6
- metadata.gz: 023f0e53440327eaa1fc5cbc63136b9684d09ff7d799dc32dd456b3e96f9f0de34309ce92c13f9b392b51d1f31a1138e640ba9aae984c62d806d40fff85b0c50
7
- data.tar.gz: d2fd9b85f3d99303f8cdb40961d061c40916234a04f611cacd6ccc95abd0b8c3e9b46a8191f5221ee5165fe4fad0e8714e72cfe53030f31870fd78b092721968
6
+ metadata.gz: 712bc1e5ca1c13f41703d630cc9bfbe9f0d9641bc9bb13a8d83bf41e3e6fd1d33103f0f35641d092e4bfdf81ffe85ca0bb1160b4c90861fdc144e84e72b8c556
7
+ data.tar.gz: 402a885f0c1f8676eea6d5c5dcb754e0e202e754b462cf63057259b99765c83fb49bc2073ed6b592c51a023043ffb4ed4238049bbbcfb8d9b2ab5b70bc1858c9
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,7 @@
1
+ = 0.0.14
2
+ * now files are streamed instead of read internally
3
+ * storages now require IO streams on put
4
+ * storage is made async
1
5
  = 0.0.13
2
6
  * fixing getters for 0.0.12
3
7
  = 0.0.12
@@ -43,7 +43,7 @@ module Blobsterix
43
43
  if raw_trafo? || raw_accept_type?(metaData.accept_type)
44
44
  # puts "Load from storage"
45
45
  return metaData unless Blobsterix.cache_original?
46
- Blobsterix.cache.put(BlobAccess.new(:bucket => bucket, :id => id), metaData.data) if metaData.valid?
46
+ Blobsterix.cache.put_raw(BlobAccess.new(:bucket => bucket, :id => id), metaData.data) if metaData.valid?
47
47
  return Blobsterix.cache.get(BlobAccess.new(:bucket => bucket, :id => id)) if metaData.valid?
48
48
  else
49
49
  # puts "accept type doesn't work"
@@ -19,7 +19,7 @@ module Blobsterix
19
19
  if env != nil && meta.size > 30000 && Blobsterix.allow_chunked_stream
20
20
  chunkresponse
21
21
  else
22
- [200, meta.header, (with_data ? meta.data : "")]
22
+ [200, meta.header, (with_data ? File.open(meta.path, "rb") : "")]
23
23
  end
24
24
  else
25
25
  [304, meta.header, ""]
@@ -67,7 +67,7 @@ module Blobsterix
67
67
  blob_access=BlobAccess.new(:source => source, :bucket => bucket_current, :id => file_current, :accept_type => accept, :trafo => trafo_current)
68
68
  data = transformation.run(blob_access)
69
69
  cached_upload_clear
70
- storage.put(bucket_current, file_current, data).response(false)
70
+ storage.put(bucket_current, file_current, data.open, :close_after_write => true).response(false)
71
71
  end
72
72
 
73
73
  def delete_bucket
@@ -14,7 +14,7 @@ module Blobsterix
14
14
  end
15
15
 
16
16
  def cache_upload
17
- cache.put(cache_upload_key, env['rack.input'].read)
17
+ cache.put_stream(cache_upload_key, env['rack.input'])
18
18
  end
19
19
 
20
20
  def cached_upload
@@ -27,7 +27,6 @@ module Blobsterix
27
27
  end
28
28
 
29
29
  def cache_upload_key
30
- #@cache_upload_key ||= "upload/"+bucket.gsub("/", "_")+"_"+file.gsub("/", "_")
31
30
  @cache_upload_key ||= Blobsterix::BlobAccess.new(:bucket => bucket, :id => "upload_#{file.gsub("/", "_")}")
32
31
  end
33
32
 
@@ -1,6 +1,7 @@
1
1
  module Blobsterix
2
2
  class Service < Goliath::API
3
3
  use Goliath::Rack::Params
4
+ include Logable
4
5
  =begin
5
6
  def on_headers(env, headers)
6
7
  env.logger.info 'received headers: ' + headers.inspect
@@ -16,8 +17,16 @@ module Blobsterix
16
17
  env.logger.info 'closing connection'
17
18
  end
18
19
  =end
20
+ def get_request_id
21
+ @request_id||=0
22
+ @request_id+=1
23
+ end
19
24
  def response(env)
20
- call_stack(env, BlobApi, StatusApi, S3Api)
25
+ env["BLOBSTERIX_REQUEST_ID"] = get_request_id
26
+ logger.info "RAM USAGE Before[#{Process.pid}]: " + `pmap #{Process.pid} | tail -1`[10,40].strip
27
+ a = call_stack(env, BlobApi, StatusApi, S3Api)
28
+ logger.info "RAM USAGE After[#{Process.pid}]: " + `pmap #{Process.pid} | tail -1`[10,40].strip
29
+ a
21
30
  end
22
31
 
23
32
  def call_stack(env, *apis)
@@ -50,6 +50,12 @@ module Blobsterix
50
50
  end
51
51
  self
52
52
  end
53
+ def open
54
+ if block_given?
55
+ #should yield file
56
+ end
57
+ self
58
+ end
53
59
  def delete
54
60
  end
55
61
  def response(with_data=true, _etag=nil, env = nil)
@@ -4,12 +4,14 @@ module Blobsterix
4
4
  include Blobsterix::Logable
5
5
 
6
6
  def invalidation
7
- each_meta_file do |meta_file|
8
- blob_access=meta_to_blob_access(meta_file)
9
- if Blobsterix.cache_checker.call(blob_access,meta_file.last_accessed,meta_file.last_modified)
10
- invalidate(blob_access, true)
7
+ Blobsterix.wait_for(Proc.new {
8
+ each_meta_file do |meta_file|
9
+ blob_access=meta_to_blob_access(meta_file)
10
+ if Blobsterix.cache_checker.call(blob_access,meta_file.last_accessed,meta_file.last_modified)
11
+ invalidate(blob_access, true)
12
+ end
11
13
  end
12
- end
14
+ })
13
15
  end
14
16
  def initialize(path)
15
17
  @path = Pathname.new(path)
@@ -20,12 +22,25 @@ module Blobsterix
20
22
  FileSystemMetaData.new(cache_file_path(blob_access))
21
23
  end
22
24
 
23
- def put(blob_access, data)
25
+ def put_raw(blob_access, data)
24
26
  FileSystemMetaData.new(cache_file_path(blob_access),:bucket => blob_access.bucket, :id => blob_access.id, :trafo => blob_access.trafo, :accept_type => "#{blob_access.accept_type}").write() {|f|
25
27
  f.write(data)
26
28
  }
27
29
  end
28
30
 
31
+ def put_stream(blob_access, stream)
32
+ FileSystemMetaData.new(cache_file_path(blob_access),:bucket => blob_access.bucket, :id => blob_access.id, :trafo => blob_access.trafo, :accept_type => "#{blob_access.accept_type}").write do |f|
33
+ FileUtils.copy_stream(stream, f)
34
+ end
35
+ end
36
+
37
+ def put(blob_access, path)
38
+ target_path = cache_file_path(blob_access)
39
+ FileUtils.mkdir_p(File.dirname(target_path))
40
+ FileUtils.cp(path, target_path, :preserve => false)
41
+ FileSystemMetaData.new(target_path,:bucket => blob_access.bucket, :id => blob_access.id, :trafo => blob_access.trafo, :accept_type => "#{blob_access.accept_type}")
42
+ end
43
+
29
44
  def delete(blob_access)
30
45
  FileSystemMetaData.new(cache_file_path(blob_access)).delete if exists?(blob_access)
31
46
  end
@@ -26,16 +26,19 @@ module Blobsterix
26
26
  else
27
27
  if bucket_exist(bucket)
28
28
  b = Bucket.new(bucket, time_string_of(bucket))
29
- bucket_files(bucket).each do |file|
30
- b.contents << BucketEntry.new(file) do |entry|
31
- meta = metaData(bucket, file)
32
- entry.last_modified = meta.last_modified.strftime("%Y-%m-%dT%H:%M:%S.000Z")
33
- entry.etag = meta.etag
34
- entry.size = meta.size
35
- entry.mimetype = meta.mimetype
36
- entry.fullpath = contents(bucket, file).gsub("#{contents}/", "")
29
+ files = bucket_files(bucket)
30
+ Blobsterix.wait_for(Proc.new {
31
+ files.each do |file|
32
+ b.contents << BucketEntry.new(file) do |entry|
33
+ meta = metaData(bucket, file)
34
+ entry.last_modified = meta.last_modified.strftime("%Y-%m-%dT%H:%M:%S.000Z")
35
+ entry.etag = meta.etag
36
+ entry.size = meta.size
37
+ entry.mimetype = meta.mimetype
38
+ entry.fullpath = contents(bucket, file).gsub("#{contents}/", "")
39
+ end
37
40
  end
38
- end
41
+ })
39
42
  b
40
43
  else
41
44
  Nokogiri::XML::Builder.new do |xml|
@@ -46,7 +49,7 @@ module Blobsterix
46
49
  end
47
50
 
48
51
  def get(bucket, key)
49
- if (not File.directory?(contents(bucket, key))) and bucket_files(bucket).include?(key)
52
+ if (not File.directory?(contents(bucket, key))) # and bucket_files(bucket).include?(key)
50
53
  Blobsterix.storage_read(BlobAccess.new(:bucket => bucket, :id => key))
51
54
  metaData(bucket, key)
52
55
  else
@@ -55,12 +58,15 @@ module Blobsterix
55
58
  end
56
59
  end
57
60
 
58
- def put(bucket, key, value)
61
+ def put(bucket, key, value, opts={})
59
62
  Blobsterix.storage_write(BlobAccess.new(:bucket => bucket, :id => key))
60
63
 
61
- meta = metaData(bucket, key).write() {|f| f.write(value.read) }
64
+ meta = Blobsterix.wait_for(Proc.new {metaData(bucket, key).write() {|f| FileUtils.copy_stream(value, f) }})
65
+
66
+ value.close if opts[:close_after_write]
67
+
68
+ Blobsterix.wait_for(Proc.new {Blobsterix.cache.invalidate(Blobsterix::BlobAccess.new(:bucket => bucket, :id => key))})
62
69
 
63
- Blobsterix.cache.invalidate(Blobsterix::BlobAccess.new(:bucket => bucket, :id => key))
64
70
  meta
65
71
  end
66
72
 
@@ -74,17 +80,15 @@ module Blobsterix
74
80
 
75
81
  def delete(bucket)
76
82
  logger.info "Storage: delete bucket #{contents(bucket)}"
77
-
78
83
  FileUtils.rm_rf(contents(bucket)) if bucket_exist(bucket) && bucket_files(bucket).empty?
79
-
80
84
  #Dir.rmdir(contents(bucket)) if bucket_exist(bucket) && bucket_files(bucket).empty?
81
85
  end
82
86
 
83
87
  def delete_key(bucket, key)
84
88
  Blobsterix.storage_delete(BlobAccess.new(:bucket => bucket, :id => key))
85
- Blobsterix.cache.invalidate(Blobsterix::BlobAccess.new(:bucket => bucket, :id => key))
89
+ Blobsterix.wait_for(Proc.new {Blobsterix.cache.invalidate(Blobsterix::BlobAccess.new(:bucket => bucket, :id => key))})
86
90
 
87
- metaData(bucket, key).delete if bucket_files(bucket).include? key
91
+ metaData(bucket, key).delete # if bucket_files(bucket).include? key
88
92
  end
89
93
 
90
94
  private
@@ -111,13 +115,15 @@ module Blobsterix
111
115
  end
112
116
 
113
117
  def bucket_files(bucket)
114
- if (bucket_exist(bucket))
115
- Dir.glob("#{contents}/#{bucket}/**/*").select{|e| !File.directory?(e) and not e.end_with?(".meta")}.map{ |e|
116
- e.gsub("#{contents}/#{bucket}/","").gsub(/\w+\/\w+\/\w+\/\w+\/\w+\/\w+\//, "").gsub("\\", "/")
117
- }
118
- else
119
- []
120
- end
118
+ Blobsterix.wait_for(Proc.new {
119
+ if (bucket_exist(bucket))
120
+ Dir.glob("#{contents}/#{bucket}/**/*").select{|e| !File.directory?(e) and not e.end_with?(".meta")}.map{ |e|
121
+ e.gsub("#{contents}/#{bucket}/","").gsub(/\w+\/\w+\/\w+\/\w+\/\w+\/\w+\//, "").gsub("\\", "/")
122
+ }
123
+ else
124
+ []
125
+ end
126
+ })
121
127
  end
122
128
 
123
129
  def metaData(bucket, key)
@@ -20,10 +20,10 @@ module Blobsterix
20
20
 
21
21
  def etag
22
22
  if @last_modified === last_modified
23
- @etag ||= Digest::MD5.hexdigest(data)
23
+ @etag ||= Digest::MD5.file(path).hexdigest
24
24
  else
25
25
  @last_modified = last_modified
26
- @etag = Digest::MD5.hexdigest(data)
26
+ @etag = Digest::MD5.file(path).hexdigest
27
27
  end
28
28
  end
29
29
 
@@ -90,6 +90,16 @@ module Blobsterix
90
90
  self
91
91
  end
92
92
 
93
+ def open
94
+ if block_given?
95
+ f = File.open(path, "rb")
96
+ yield f
97
+ f.close
98
+ else
99
+ File.open(path, "rb")
100
+ end
101
+ end
102
+
93
103
  def delete
94
104
  File.delete(meta_path) if File.exists?(meta_path)
95
105
  File.delete(path) if valid
@@ -44,7 +44,7 @@ module Blobsterix::Transformations
44
44
  break
45
45
  end
46
46
 
47
- cache.put(@target_blob_access,Blobsterix::Storage::FileSystemMetaData.new(last_key).read)
47
+ cache.put(@target_blob_access, last_key)
48
48
  @target_blob_access.reset!
49
49
  end unless @target_blob_access.get.valid
50
50
 
@@ -1,3 +1,3 @@
1
1
  module Blobsterix
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
data/lib/blobsterix.rb CHANGED
@@ -227,4 +227,18 @@ module Blobsterix
227
227
  def self.storage_delete(blob_access)
228
228
  event("storage.delete",:blob_access => blob_access)
229
229
  end
230
+
231
+ def self.wait_for(op = nil)
232
+ fiber = Fiber.current
233
+ EM.defer(op, Proc.new {|result|
234
+ fiber.resume result
235
+ })
236
+ Fiber.yield
237
+ end
238
+
239
+ def self.wait_for_next(op = nil)
240
+ EM.next_tick do
241
+ wait_for(op)
242
+ end
243
+ end
230
244
  end
@@ -1,10 +1,16 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Blobsterix::BlobApi do
4
+ include Blobsterix::SpecHelper
4
5
  include Rack::Test::Methods
5
6
  def app
6
7
  Blobsterix::BlobApi
7
8
  end
9
+
10
+ around(:each) do |example|
11
+ run_em(&example)
12
+ end
13
+
8
14
  describe 'GET /blob/v1/' do
9
15
  it 'get several categories of repositories by name' do
10
16
  get "/blob/v1/"
@@ -13,7 +19,6 @@ describe Blobsterix::BlobApi do
13
19
  end
14
20
 
15
21
  describe 'Transformed get' do
16
- include Blobsterix::SpecHelper
17
22
 
18
23
  context "with data" do
19
24
  let(:data) {"Hi my name is Test"}
@@ -39,18 +44,14 @@ describe Blobsterix::BlobApi do
39
44
 
40
45
  it "should return the file" do
41
46
  expect(Blobsterix.transformation).to receive(:cue_transformation).once.and_call_original
42
- run_em do
43
- get "/blob/v1/dummy_#{data_transformed}.test/test.txt"
44
- end
47
+ get "/blob/v1/dummy_#{data_transformed}.test/test.txt"
45
48
  expect(last_response.status).to eql(200)
46
49
  expect(last_response.body).to eql(data_transformed)
47
50
  end
48
51
 
49
52
  it "should return the file head" do
50
53
  expect(Blobsterix.transformation).to receive(:cue_transformation).once.and_call_original
51
- run_em do
52
- head "/blob/v1/dummy.test/test.txt"
53
- end
54
+ head "/blob/v1/dummy.test/test.txt"
54
55
  expect(last_response.status).to eql(200)
55
56
  expect(last_response.body).to eql("")
56
57
  end
@@ -58,10 +59,8 @@ describe Blobsterix::BlobApi do
58
59
  it "should return the file and wait for previous trafos to finish" do
59
60
  expect(Blobsterix.transformation).to receive(:cue_transformation).once.and_call_original
60
61
  expect(Blobsterix.transformation).to receive(:wait_for_transformation).once.and_call_original
61
- run_em do
62
- get "/blob/v1/dummy_#{data_transformed}.test/test.txt"
63
- get "/blob/v1/dummy_#{data_transformed}.test/test.txt"
64
- end
62
+ get "/blob/v1/dummy_#{data_transformed}.test/test.txt"
63
+ get "/blob/v1/dummy_#{data_transformed}.test/test.txt"
65
64
  expect(last_response.status).to eql(200)
66
65
  expect(last_response.body).to eql(data_transformed)
67
66
  end
@@ -69,10 +68,8 @@ describe Blobsterix::BlobApi do
69
68
  it "should return the file and not wait for different trafos to finish" do
70
69
  expect(Blobsterix.transformation).to receive(:cue_transformation).twice.and_call_original
71
70
  expect(Blobsterix.transformation).to receive(:wait_for_transformation).never.and_call_original
72
- run_em do
73
- get "/blob/v1/dummy_#{data_transformed},dummy_#{data_transformed}.test/test.txt"
74
- get "/blob/v1/dummy_#{data_transformed}.test/test.txt"
75
- end
71
+ get "/blob/v1/dummy_#{data_transformed},dummy_#{data_transformed}.test/test.txt"
72
+ get "/blob/v1/dummy_#{data_transformed}.test/test.txt"
76
73
  expect(last_response.status).to eql(200)
77
74
  expect(last_response.body).to eql(data_transformed)
78
75
  end
@@ -23,6 +23,10 @@ describe Blobsterix::BlobAccess do
23
23
  Blobsterix::BlobAccess.new(:bucket => bucket, :id => key, :trafo => [["raw", ""]], :accept_type => Blobsterix::AcceptType.new("text/plain"))
24
24
  end
25
25
 
26
+ around(:each) do |example|
27
+ run_em(&example)
28
+ end
29
+
26
30
  describe "blob_access" do
27
31
  after :each do
28
32
  clear_data
@@ -11,6 +11,10 @@ describe Blobsterix::S3Api do
11
11
  let(:key) {"test.txt"}
12
12
  let(:bucket) {"test"}
13
13
 
14
+ around(:each) do |example|
15
+ run_em(&example)
16
+ end
17
+
14
18
  after :each do
15
19
  clear_data
16
20
  end
@@ -18,9 +22,7 @@ describe Blobsterix::S3Api do
18
22
  describe "create a bucket" do
19
23
  it "should have bucket after creation" do
20
24
 
21
- run_em do
22
- put "/", "", "HTTP_HOST" => "#{bucket}.s3.blah.de"
23
- end
25
+ put "/", "", "HTTP_HOST" => "#{bucket}.s3.blah.de"
24
26
 
25
27
  get "/#{bucket}"
26
28
  expect(last_response.status).to eql(200)
@@ -46,9 +48,7 @@ describe Blobsterix::S3Api do
46
48
  it "should have file in bucket after upload" do
47
49
  #expect(Blobsterix.transformation).to receive(:cue_transformation).never.and_call_original
48
50
 
49
- run_em do
50
- put "/#{key}", data, {"HTTP_HOST" => "#{bucket}.s3.blah.de"}
51
- end
51
+ put "/#{key}", data, {"HTTP_HOST" => "#{bucket}.s3.blah.de"}
52
52
 
53
53
  expect(last_response.status).to eql(200)
54
54
  expect(Blobsterix.storage.get(bucket, key).read).to eql(data)
@@ -57,9 +57,7 @@ describe Blobsterix::S3Api do
57
57
  it "should have file in bucket after upload with trafo" do
58
58
  #expect(Blobsterix.transformation).to receive(:cue_transformation).once.and_call_original
59
59
 
60
- run_em do
61
- put "/#{key}", data, {"HTTP_HOST" => "#{bucket}.s3.blah.de", "HTTP_X_AMZ_META_TRAFO" => "dummy_Yeah"}
62
- end
60
+ put "/#{key}", data, {"HTTP_HOST" => "#{bucket}.s3.blah.de", "HTTP_X_AMZ_META_TRAFO" => "dummy_Yeah"}
63
61
 
64
62
  expect(last_response.status).to eql(200)
65
63
  expect(Blobsterix.storage.get(bucket, key).read).to eql("Yeah")
@@ -12,12 +12,16 @@ describe Blobsterix::Storage::Cache do
12
12
  let(:blob_access_2) {Blobsterix::BlobAccess.new(:bucket => bucket, :id => key, :trafo => [["dummy", ""]])}
13
13
  let(:blob_access_3) {Blobsterix::BlobAccess.new(:bucket => bucket, :id => key, :trafo => [["test", ""],["dummy", ""]])}
14
14
 
15
+ around(:each) do |example|
16
+ run_em(&example)
17
+ end
18
+
15
19
  describe "invalidation" do
16
20
  before :each do
17
- Blobsterix.cache.put(blob_access, data)
18
- Blobsterix.cache.put(blob_access_1, data)
19
- Blobsterix.cache.put(blob_access_2, data)
20
- Blobsterix.cache.put(blob_access_3, data)
21
+ Blobsterix.cache.put_raw(blob_access, data)
22
+ Blobsterix.cache.put_raw(blob_access_1, data)
23
+ Blobsterix.cache.put_raw(blob_access_2, data)
24
+ Blobsterix.cache.put_raw(blob_access_3, data)
21
25
  end
22
26
 
23
27
  after :each do
@@ -68,14 +72,32 @@ describe Blobsterix::Storage::Cache do
68
72
  end
69
73
 
70
74
  it "should return valid blob when key exists" do
71
- Blobsterix.cache.put(blob_access, data)
75
+ Blobsterix.cache.put_raw(blob_access, data)
76
+ metaData = Blobsterix.cache.get(blob_access)
77
+ expect(metaData.valid).to be(true)
78
+ expect(metaData.read).to eql(data)
79
+ end
80
+
81
+ it "should return valid blob when key exists and was copied via Stream" do
82
+ Blobsterix.cache.put_stream(blob_access, StringIO.new(data, "r"))
83
+ metaData = Blobsterix.cache.get(blob_access)
84
+ expect(metaData.valid).to be(true)
85
+ expect(metaData.read).to eql(data)
86
+ end
87
+
88
+ it "should return valid blob when key exists and was copied via path" do
89
+ tmp = Tempfile.new("sldhgs")
90
+ tmp.write(data)
91
+ tmp.close
92
+ Blobsterix.cache.put(blob_access, tmp.path)
72
93
  metaData = Blobsterix.cache.get(blob_access)
73
94
  expect(metaData.valid).to be(true)
74
95
  expect(metaData.read).to eql(data)
96
+ tmp.unlink
75
97
  end
76
98
 
77
99
  it "should return invalid blob when key is invalidated" do
78
- Blobsterix.cache.put(blob_access, data)
100
+ Blobsterix.cache.put_raw(blob_access, data)
79
101
  metaData = Blobsterix.cache.get(blob_access)
80
102
  expect(metaData.valid).to be(true)
81
103
  expect(metaData.read).to eql(data)
@@ -86,8 +108,8 @@ describe Blobsterix::Storage::Cache do
86
108
  end
87
109
 
88
110
  it "should return invalid blob when key is invalidated for all trafos" do
89
- Blobsterix.cache.put(blob_access, data)
90
- Blobsterix.cache.put(blob_access_1, data)
111
+ Blobsterix.cache.put_raw(blob_access, data)
112
+ Blobsterix.cache.put_raw(blob_access_1, data)
91
113
 
92
114
  metaData = Blobsterix.cache.get(blob_access)
93
115
  expect(metaData.valid).to be(true)
@@ -104,8 +126,8 @@ describe Blobsterix::Storage::Cache do
104
126
  end
105
127
 
106
128
  it "should return invalid blob when key is invalidated for one trafos" do
107
- Blobsterix.cache.put(blob_access, data)
108
- Blobsterix.cache.put(blob_access_1, data)
129
+ Blobsterix.cache.put_raw(blob_access, data)
130
+ Blobsterix.cache.put_raw(blob_access_1, data)
109
131
 
110
132
  metaData = Blobsterix.cache.get(blob_access)
111
133
  expect(metaData.valid).to be(true)
@@ -122,7 +144,7 @@ describe Blobsterix::Storage::Cache do
122
144
  end
123
145
 
124
146
  it "should return invalid blob when key is deleted" do
125
- Blobsterix.cache.put(blob_access, data)
147
+ Blobsterix.cache.put_raw(blob_access, data)
126
148
  metaData = Blobsterix.cache.get(blob_access)
127
149
  expect(metaData.valid).to be(true)
128
150
  expect(metaData.read).to eql(data)
@@ -6,9 +6,11 @@ describe Blobsterix::Storage::FileSystem do
6
6
  let(:data) {"Hi my name is Test"}
7
7
  let(:key) {"test.txt"}
8
8
  let(:bucket) {"test"}
9
-
10
-
11
-
9
+
10
+ around(:each) do |example|
11
+ run_em(&example)
12
+ end
13
+
12
14
  describe "bucket" do
13
15
  after :each do
14
16
  clear_storage
data/spec/spec_helper.rb CHANGED
@@ -30,9 +30,12 @@ module Blobsterix
30
30
  end
31
31
  def run_em(&block)
32
32
  EM.run {
33
- f = Fiber.new(&block)
33
+ f = Fiber.new{
34
+ yield block
35
+ while not EM.defers_finished?; end
36
+ EM.stop
37
+ }
34
38
  f.resume
35
- EM.stop
36
39
  }
37
40
  end
38
41
  class DummyTrafo < Blobsterix::Transformations::Transformation
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blobsterix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Sudmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-29 00:00:00.000000000 Z
11
+ date: 2014-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json