blobsterix 0.0.30 → 0.0.31

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: 29dfaa5cb3dda50826724e03e737914de1a359db
4
- data.tar.gz: eefb565bd322f7fab35de1cb7fcb76024d7a763c
3
+ metadata.gz: a1b4e9b58a1661c708d9ac142fc024e6d8a9ade4
4
+ data.tar.gz: 65864bd8e7ba85eea992a657c6dac5278e733e21
5
5
  SHA512:
6
- metadata.gz: 0efb1c4cede08902253ad65ed0754716d19ae6735fc46c73e95983c447d415b18a271cf03061540b6ec865b7f0541d5d24e53fc8f0751d12fcf937eff3a7fd08
7
- data.tar.gz: e4e594eb8a6b542c82331a1deea6f475b6ee2396e860ea98a604caff9864de35eff7b41a4105b35c88348cdcba312f4d49de36b7b7392617881018d600c7d8ad
6
+ metadata.gz: 7a093e1ba033c6ccc930bd12196c8dacc378840a669e8fcf7cacf7cda92bdeda9eeb41a0b39a6a465cb9e1c3b30745053c923258f17cace08af72481495940df
7
+ data.tar.gz: 101beace4d57ba6454d8937144250db5ed97b21e22e35b3cbb284ae7da0f662e31f655ea1b2c7d120a5dc7d93bd98ae626b714af9dbf5c4469bf7c61f5b71211
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,6 @@
1
+ = 0.0.31
2
+ * changed the cache invalidation call to use a meta_data object as well as blobaccess
3
+ * brakes current cache_checker implementations!
1
4
  = 0.0.29
2
5
  * changed some standard transformations
3
6
  = 0.0.28
@@ -5,11 +5,14 @@ module Blobsterix
5
5
 
6
6
  def invalidation
7
7
  each_meta_file do |meta_file|
8
+ meta_data = Blobsterix::SimpleProxy.new(Proc.new {
9
+ FileSystemMetaData.new(meta_file)
10
+ })
8
11
  blob_access = Blobsterix::SimpleProxy.new(Proc.new {
9
12
  meta_to_blob_access(FileSystemMetaData.new(meta_file))
10
13
  })
11
- if Blobsterix.cache_checker.call(blob_access,File.atime(meta_file),File.ctime(meta_file))
12
- invalidate(blob_access, true)
14
+ if Blobsterix.cache_checker.call(blob_access, meta_data, File.atime(meta_file), File.ctime(meta_file))
15
+ meta_data.delete
13
16
  end
14
17
  end
15
18
  end
@@ -147,13 +147,17 @@ module Blobsterix
147
147
  if not File.exists?(meta_path)
148
148
  save_meta_file
149
149
  else
150
- data = JSON.load File.read(meta_path)
151
- @mimetype = data["mimetype"]
152
- @mediatype = data["mediatype"]
153
- @etag = data["etag"]
154
- @size = data["size"]
155
- @payload = JSON.load(data["payload"]) || {}
156
- @mimeclass = MimeMagic.new(@mimetype)
150
+ begin
151
+ data = JSON.load(File.read(meta_path)) || {}
152
+ @mimetype = data["mimetype"]
153
+ @mediatype = data["mediatype"]
154
+ @etag = data["etag"]
155
+ @size = data["size"]
156
+ @payload = JSON.load(data["payload"]) || {}
157
+ @mimeclass = @mimetype ? MimeMagic.new(@mimetype) : nil
158
+ rescue JSON::ParserError => e
159
+ save_meta_file
160
+ end
157
161
  end
158
162
  end
159
163
  end
@@ -1,3 +1,3 @@
1
1
  module Blobsterix
2
- VERSION = "0.0.30"
2
+ VERSION = "0.0.31"
3
3
  end
data/lib/blobsterix.rb CHANGED
@@ -196,7 +196,7 @@ module Blobsterix
196
196
  end
197
197
 
198
198
  def self.cache_checker
199
- @@cache_checker||=lambda{|blob_access, last_accessed_at, created_at|
199
+ @@cache_checker||=lambda{|blob_access, meta_data, last_accessed_at, created_at|
200
200
  false
201
201
  }
202
202
  end
@@ -26,13 +26,13 @@ describe Blobsterix::Storage::Cache do
26
26
 
27
27
  after :each do
28
28
  clear_cache
29
- Blobsterix.cache_checker=lambda{|blob_access, last_accessed_at, created_at|
29
+ Blobsterix.cache_checker=lambda{|blob_access, meta_data, last_accessed_at, created_at|
30
30
  false
31
31
  }
32
32
  end
33
33
 
34
34
  it "should follow invalidation structure" do
35
- Blobsterix.cache_checker=lambda{|blob_access_, last_accessed_at, created_at|
35
+ Blobsterix.cache_checker=lambda{|blob_access_, meta_data, last_accessed_at, created_at|
36
36
  blob_access_1.equals?(blob_access_) || blob_access_3.equals?(blob_access_)
37
37
  }
38
38
  Blobsterix.cache.invalidation
@@ -43,7 +43,7 @@ describe Blobsterix::Storage::Cache do
43
43
  end
44
44
 
45
45
  it "should invalidate all" do
46
- Blobsterix.cache_checker=lambda{|blob_access_, last_accessed_at, created_at|
46
+ Blobsterix.cache_checker=lambda{|blob_access_, meta_data, last_accessed_at, created_at|
47
47
  true
48
48
  }
49
49
  Blobsterix.cache.invalidation
@@ -24,7 +24,7 @@
24
24
  # }
25
25
 
26
26
  # # Use a specific cache checker for invalidation
27
- # Blobsterix.cache_checker= lambda { |blob_access, last_accessed_at, created_at|
27
+ # Blobsterix.cache_checker= lambda { |blob_access, meta_data, last_accessed_at, created_at|
28
28
  # false # return true to invalidate the cache entry
29
29
  # }
30
30
 
@@ -24,7 +24,7 @@
24
24
  # }
25
25
 
26
26
  # # Use a specific cache checker for invalidation
27
- # Blobsterix.cache_checker= lambda { |blob_access, last_accessed_at, created_at|
27
+ # Blobsterix.cache_checker= lambda { |blob_access, meta_data, last_accessed_at, created_at|
28
28
  # false # return true to invalidate the cache entry
29
29
  # }
30
30
 
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.30
4
+ version: 0.0.31
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-12-10 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json