Object
A basic FS-bound ruote storage. Leverages rufus-cloche (github.com/jmettraux/rufus-cloche).
Warning : for JRuby 1.4.0 on Ubuntu, passing the cloche_nolock option set to true seems necessary. See groups.google.com/group/openwferu-users/t/d82516ed3bdd8f23
Creates a FsStorage pointing to the given dir.
The options are classical engine configuration, but the 'cloche_nolock' option is read by the storage and followed.
# File lib/ruote/storage/fs_storage.rb, line 60 def initialize (dir, options={}) FileUtils.mkdir_p(dir) @cloche = Rufus::Cloche.new( :dir => dir, :nolock => options['cloche_nolock']) @options = options @cloche.put(@options.merge('type' => 'configurations', '_id' => 'engine')) end
No need for that here (FsStorage adds type on the fly).
# File lib/ruote/storage/fs_storage.rb, line 104 def add_type (type) end
# File lib/ruote/storage/fs_storage.rb, line 82 def delete (doc) @cloche.delete(doc) end
# File lib/ruote/storage/fs_storage.rb, line 112 def dump (type) s = "=== #{type} ===\n" @cloche.get_many(type).inject(s) do |s1, e| s1 << "\n" e.keys.sort.inject(s1) do |s2, k| s2 << " #{k} => #{e[k].inspect}\n" end end end
# File lib/ruote/storage/fs_storage.rb, line 77 def get (type, key) @cloche.get(type, key) end
# File lib/ruote/storage/fs_storage.rb, line 87 def get_many (type, key=nil, opts={}) @cloche.get_many(type, key, opts) end
# File lib/ruote/storage/fs_storage.rb, line 92 def ids (type) @cloche.ids(type) end
# File lib/ruote/storage/fs_storage.rb, line 97 def purge! FileUtils.rm_rf(@cloche.dir) end
Generated with the Darkfish Rdoc Generator 2.