defog 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # defog
2
2
 
3
3
  [<img
4
- src="https://secure.travis-ci.org/ronen/defog.png"/>](http://travis-ci.org/ron
5
- en/defog) [<img src="https://gemnasium.com/ronen/defog.png" alt="Dependency
4
+ src="https://secure.travis-ci.org/ronen/defog.png"/>](http://travis-ci.org/ronen/defog) [<img src="https://gemnasium.com/ronen/defog.png" alt="Dependency
6
5
  Status" />](https://gemnasium.com/ronen/defog)
7
6
 
8
7
  Defog wraps the [fog](https://rubygems.org/gems/fog) gem (specifically,
@@ -205,6 +204,20 @@ And it's fair game to delete proxy files outside of Defog, such as via a cron
205
204
  job. Of course in these cases it's up to you to make sure not to
206
205
  unintentionally delete a proxy file that's currently open.
207
206
 
207
+ ### Multiple Defog proxies, prefix, and cache sharing.
208
+
209
+ Sometimes you may want to have multiple Defog proxies, each scoped to a
210
+ different "subdirectory" of a cloud storage location -- but all of them sharing a single cache in order to limit the max cache size across them all).
211
+
212
+ That works OK out of the box (as of v0.8.0): the default `proxy_root` is created without regard for the `prefix` -- but the `proxy_path` for files within the cache does include the prefix. So it's safe to create multiple defog proxies that differ only in `prefix`, and they will share the cache without colliding with each other.
213
+
214
+ Notes:
215
+
216
+ * Each defog proxy will manage the entire cache based on its own `max_cache_size` setting. So presumably you would pass the same `max_cache_size` to each.
217
+
218
+ * Best to avoid multithreading though, as there's no locking around the cache management. So in principle one thread could delete a proxy that another thread is using.
219
+
220
+
208
221
  ## Accessing Fog
209
222
 
210
223
  You can access the underlying fog objects as needed:
@@ -218,6 +231,7 @@ You can access the underlying fog objects as needed:
218
231
  ## Installation
219
232
 
220
233
  Gemfile:
234
+
221
235
  gem 'defog'
222
236
 
223
237
  ## Compatibility
@@ -237,11 +251,12 @@ plus appropriate rspec examples.)
237
251
 
238
252
  Release Notes:
239
253
 
240
- * 0.7.2 - Bug fix: don't fail when clearing cache if another process clears it first
241
- * 0.7.1 - Add key info to message if there's an exception when getting file
242
- * 0.7.0 - Add :query option to Handle#url
243
- * 0.6.1 - Bug fix (caching)
244
- * 0.6.0 - Add logging
254
+ * 0.8.0 - Include prefix in proxy_path (thus allowing cache sharing)
255
+ * 0.7.2 - Bug fix: don't fail when clearing cache if another process clears it first
256
+ * 0.7.1 - Add key info to message if there's an exception when getting file
257
+ * 0.7.0 - Add :query option to Handle#url
258
+ * 0.6.1 - Bug fix (caching)
259
+ * 0.6.0 - Add logging
245
260
 
246
261
 
247
262
  ## Copyright
data/lib/defog/handle.rb CHANGED
@@ -32,7 +32,7 @@ module Defog
32
32
  def initialize(proxy, key) #:nodoc:
33
33
  @proxy = proxy
34
34
  @key = key
35
- @proxy_path = Pathname.new("#{@proxy.proxy_root}/#{@key}").expand_path
35
+ @proxy_path = Pathname.new("#{@proxy.proxy_root}/#{@proxy.prefix}#{@key}").expand_path
36
36
  end
37
37
 
38
38
  def to_s
data/lib/defog/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Defog
2
- VERSION = "0.7.2"
2
+ VERSION = "0.8.0"
3
3
  end
data/spec/handle_spec.rb CHANGED
@@ -14,6 +14,21 @@ shared_examples "a handle" do |proxyargs|
14
14
  @handle.to_s.should include key
15
15
  end
16
16
 
17
+ context "proxy path" do
18
+ it "should start with proxy root" do
19
+ @handle.proxy_path.to_s.should start_with(@proxy.proxy_root.to_s)
20
+ end
21
+
22
+ it "should end with key" do
23
+ @handle.proxy_path.to_s.should end_with(key)
24
+ end
25
+
26
+ it "should include prefix" do
27
+ prefix = "IAmAPrefix"
28
+ Defog::Proxy.new(proxyargs.merge(:prefix => prefix)).file(key).proxy_path.to_s.should include(prefix.to_s)
29
+ end
30
+ end
31
+
17
32
  it "should report exist? true if remote cloud file exists" do
18
33
  create_remote("i exist")
19
34
  @handle.should be_exist
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-27 00:00:00.000000000 Z
12
+ date: 2013-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog