class LogStash::Outputs::Swift::TemporaryFileFactory::IOWrappedGzip

Attributes

file_io[R]
gzip_writer[R]

Public Class Methods

new(file_io) click to toggle source
# File lib/logstash/outputs/swift/temporary_file_factory.rb, line 101
def initialize(file_io)
  @file_io = file_io
  @gzip_writer = Zlib::GzipWriter.open(file_io)
end

Public Instance Methods

fsync() click to toggle source
# File lib/logstash/outputs/swift/temporary_file_factory.rb, line 122
def fsync
  @gzip_writer.to_io.fsync
end
path() click to toggle source
# File lib/logstash/outputs/swift/temporary_file_factory.rb, line 106
def path
  @gzip_writer.to_io.path
end
size() click to toggle source
# File lib/logstash/outputs/swift/temporary_file_factory.rb, line 110
def size
  # to get the current file size
  if @gzip_writer.pos == 0
    # Ensure a zero file size is returned when nothing has
    # yet been written to the gzip file.
    0
  else
    @gzip_writer.flush
    @gzip_writer.to_io.size
  end
end