Class: Fluent::PluginHelper::Storage::SynchronizeWrapper
- Inherits:
-
Object
- Object
- Fluent::PluginHelper::Storage::SynchronizeWrapper
show all
- Extended by:
- Forwardable
- Defined in:
- lib/fluent/plugin_helper/storage.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of SynchronizeWrapper.
289
290
291
292
|
# File 'lib/fluent/plugin_helper/storage.rb', line 289
def initialize(storage)
@storage = storage
@monitor = Monitor.new
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
299
300
301
|
# File 'lib/fluent/plugin_helper/storage.rb', line 299
def method_missing(name, *args)
@monitor.synchronize{ @storage.__send__(name, *args) }
end
|
Instance Method Details
#delete(key) ⇒ Object
335
336
337
|
# File 'lib/fluent/plugin_helper/storage.rb', line 335
def delete(key)
@monitor.synchronize{ @storage.delete(key) }
end
|
#fetch(key, defval) ⇒ Object
327
328
329
|
# File 'lib/fluent/plugin_helper/storage.rb', line 327
def fetch(key, defval)
@monitor.synchronize{ @storage.fetch(key, defval) }
end
|
#get(key) ⇒ Object
323
324
325
|
# File 'lib/fluent/plugin_helper/storage.rb', line 323
def get(key)
@monitor.synchronize{ @storage.get(key) }
end
|
#implementation ⇒ Object
307
308
309
|
# File 'lib/fluent/plugin_helper/storage.rb', line 307
def implementation
@storage
end
|
#load ⇒ Object
311
312
313
314
315
|
# File 'lib/fluent/plugin_helper/storage.rb', line 311
def load
@monitor.synchronize do
@storage.load
end
end
|
#put(key, value) ⇒ Object
331
332
333
|
# File 'lib/fluent/plugin_helper/storage.rb', line 331
def put(key, value)
@monitor.synchronize{ @storage.put(key, value) }
end
|
#save ⇒ Object
317
318
319
320
321
|
# File 'lib/fluent/plugin_helper/storage.rb', line 317
def save
@monitor.synchronize do
@storage.save
end
end
|
#synchronized? ⇒ Boolean
303
304
305
|
# File 'lib/fluent/plugin_helper/storage.rb', line 303
def synchronized?
true
end
|
#update(key, &block) ⇒ Object
339
340
341
342
343
344
345
|
# File 'lib/fluent/plugin_helper/storage.rb', line 339
def update(key, &block)
@monitor.synchronize do
v = block.call(@storage.get(key))
@storage.put(key, v)
v
end
end
|