class LogStash::Outputs::Qingstor::FileRepository::PrefixedValue

Public Class Methods

new(file_factory, stale_time) click to toggle source
# File lib/logstash/outputs/qingstor/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/qingstor/file_repository.rb, line 37
def apply(_prefix)
  self
end
delete!() click to toggle source
# File lib/logstash/outputs/qingstor/file_repository.rb, line 41
def delete!
  with_lock { |factory| factory.current.delete! }
end
stale?() click to toggle source
# File lib/logstash/outputs/qingstor/file_repository.rb, line 30
def stale?
  with_lock do |factory|
    factory.current.empty? &&
      (Time.now - factory.current.ctime > @stale_time)
  end
end
with_lock() { |file_factory| ... } click to toggle source
# File lib/logstash/outputs/qingstor/file_repository.rb, line 24
def with_lock
  @lock.synchronize do
    yield @file_factory
  end
end