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 51 def initialize(dir, options={}) if dir.is_a?(Hash) && options == {} options = dir dir = options.delete('dir') end FileUtils.mkdir_p(dir) @cloche = Rufus::Cloche.new( :dir => dir, :nolock => options['cloche_nolock']) replace_engine_configuration(options) end
No need for that here (FsStorage can add types on the fly).
# File lib/ruote/storage/fs_storage.rb, line 115 def add_type(type) end
# File lib/ruote/storage/fs_storage.rb, line 85 def delete(doc) @cloche.delete(doc) end
# File lib/ruote/storage/fs_storage.rb, line 66 def dir @cloche.dir end
# File lib/ruote/storage/fs_storage.rb, line 80 def get(type, key) @cloche.get(type, key) end
# File lib/ruote/storage/fs_storage.rb, line 90 def get_many(type, key=nil, opts={}) keys = key ? Array(key) : nil keys = keys.map { |k| type == 'schedules' ? /!#{k}-\d+$/ : "!#{k}" } if keys && keys.first.is_a?(String) @cloche.get_many(type, keys, opts) end
# File lib/ruote/storage/fs_storage.rb, line 101 def ids(type) @cloche.ids(type) end
Purges the storage completely.
# File lib/ruote/storage/fs_storage.rb, line 108 def purge! FileUtils.rm_rf(@cloche.dir) end
# File lib/ruote/storage/fs_storage.rb, line 118 def purge_type!(type) @cloche.purge_type!(type) end
Generated with the Darkfish Rdoc Generator 2.