Class: LogStash::Outputs::OSS::GzipFile

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ GzipFile

Returns a new instance of GzipFile.



12
13
14
15
# File 'lib/logstash/outputs/oss/gzip_file.rb', line 12

def initialize(file)
  @file = file
  @gzip_writer = Zlib::GzipWriter.new(file)
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



10
11
12
# File 'lib/logstash/outputs/oss/gzip_file.rb', line 10

def file
  @file
end

#gzip_writerObject (readonly)

Returns the value of attribute gzip_writer.



10
11
12
# File 'lib/logstash/outputs/oss/gzip_file.rb', line 10

def gzip_writer
  @gzip_writer
end

Instance Method Details

#fsyncObject



30
31
32
# File 'lib/logstash/outputs/oss/gzip_file.rb', line 30

def fsync
  @gzip_writer.to_io.fsync
end

#pathObject



17
18
19
# File 'lib/logstash/outputs/oss/gzip_file.rb', line 17

def path
  @gzip_writer.to_io.path
end

#sizeObject



21
22
23
24
25
26
27
28
# File 'lib/logstash/outputs/oss/gzip_file.rb', line 21

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