class LogStash::Outputs::LogstashAzureBlobOutput::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

initialize the factory

# File lib/logstash/outputs/blob/file_repository.rb, line 21
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

return this class

# File lib/logstash/outputs/blob/file_repository.rb, line 40
def apply(_prefix)
  self
end
delete!() click to toggle source

delete the current factory

# File lib/logstash/outputs/blob/file_repository.rb, line 45
def delete!
  with_lock { |factory| factory.current.delete! }
end
stale?() click to toggle source

boolean method

# File lib/logstash/outputs/blob/file_repository.rb, line 35
def stale?
  with_lock { |factory| factory.current.size.zero? && (Time.now - factory.current.ctime > @stale_time) }
end
with_lock() { |file_factory| ... } click to toggle source

activate the lock

# File lib/logstash/outputs/blob/file_repository.rb, line 28
def with_lock
  @lock.synchronize do
    yield @file_factory
  end
end