Class: LogStash::Outputs::Qingstor::TemporaryFileFactory::IOWrappedGzip

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/logstash/outputs/qingstor/temporary_file_factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_io) ⇒ IOWrappedGzip



92
93
94
95
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 92

def initialize(file_io)
  @file_io = file_io
  @gzip_writer = Zlib::GzipWriter.open(file_io)
end

Instance Attribute Details

#file_ioObject

Returns the value of attribute file_io.



90
91
92
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 90

def file_io
  @file_io
end

#gzip_writerObject

Returns the value of attribute gzip_writer.



90
91
92
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 90

def gzip_writer
  @gzip_writer
end

Instance Method Details

#fsyncObject



110
111
112
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 110

def fsync
  @gzip_writer.to_io.fsync
end

#pathObject



97
98
99
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 97

def path
  @gzip_writer.to_io.path
end

#sizeObject



101
102
103
104
105
106
107
108
# File 'lib/logstash/outputs/qingstor/temporary_file_factory.rb', line 101

def size
  if @gzip_writer.pos == 0
    0
  else
    @gzip_writer.flush
    @gzip_writer.to_io.size
  end
end