class Fluent::PluginHelper::Storage::PersistentWrapper

Public Class Methods

new(storage) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 198
def initialize(storage)
  @storage = storage
  @monitor = Monitor.new
end

Public Instance Methods

autosave() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 219
def autosave
  false
end
delete(key) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 266
def delete(key)
  @monitor.synchronize do
    @storage.load
    val = @storage.delete(key)
    @storage.save
    val
  end
end
fetch(key, defval) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 250
def fetch(key, defval)
  @monitor.synchronize do
    @storage.load
    @storage.fetch(key, defval)
  end
end
get(key) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 243
def get(key)
  @monitor.synchronize do
    @storage.load
    @storage.get(key)
  end
end
implementation() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 227
def implementation
  @storage
end
load() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 231
def load
  @monitor.synchronize do
    @storage.load
  end
end
method_missing(name, *args) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 207
def method_missing(name, *args)
  @monitor.synchronize{ @storage.__send__(name, *args) }
end
persistent() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 215
def persistent
  true
end
persistent_always?() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 211
def persistent_always?
  true
end
put(key, value) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 257
def put(key, value)
  @monitor.synchronize do
    @storage.load
    @storage.put(key, value)
    @storage.save
    value
  end
end
save() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 237
def save
  @monitor.synchronize do
    @storage.save
  end
end
synchronized?() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 223
def synchronized?
  true
end
update(key, &block) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 275
def update(key, &block)
  @monitor.synchronize do
    @storage.load
    v = block.call(@storage.get(key))
    @storage.put(key, v)
    @storage.save
    v
  end
end