class LogStash::Outputs::Gcs::SynchronizedLogFile

SynchronizedLogFile wraps another log file and uses reentrant locks around its methods to prevent concurrent modification.

Public Class Methods

new(child) click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 89
def initialize(child)
  @child = child
  @lock = Concurrent::ReentrantReadWriteLock.new
end

Public Instance Methods

method_missing(method_name, *args, &block) click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 102
def method_missing(method_name, *args, &block)
  # unless otherwise specified, get a write lock
  @lock.with_write_lock do
    @child.send(method_name, *args, &block)
  end
end
path() click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 98
def path
  @lock.with_read_lock { @child.path }
end
time_since_sync() click to toggle source
# File lib/logstash/outputs/gcs/temp_log_file.rb, line 94
def time_since_sync
  @lock.with_read_lock { @child.time_since_sync }
end