class LogStash::Outputs::Swift::FileRepository::PrefixedValue
Ensure that all access or work done on a factory is threadsafe
Public Class Methods
new(file_factory, stale_time)
click to toggle source
# File lib/logstash/outputs/swift/file_repository.rb, line 18 def initialize(file_factory, stale_time) @file_factory = file_factory @lock = Mutex.new @stale_time = stale_time end
Public Instance Methods
apply(prefix)
click to toggle source
# File lib/logstash/outputs/swift/file_repository.rb, line 34 def apply(prefix) return self end
delete!()
click to toggle source
# File lib/logstash/outputs/swift/file_repository.rb, line 38 def delete! with_lock{ |factory| factory.current.delete! } end
stale?()
click to toggle source
# File lib/logstash/outputs/swift/file_repository.rb, line 30 def stale? with_lock { |factory| factory.current.size == 0 && (Time.now - factory.current.ctime > @stale_time) } end
with_lock() { |file_factory| ... }
click to toggle source
# File lib/logstash/outputs/swift/file_repository.rb, line 24 def with_lock @lock.synchronize { yield @file_factory } end