Class: Fluent::PullBufferChunk

Inherits:
FileBufferChunk
  • Object
show all
Defined in:
lib/fluent/plugin/buf_pullpool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, path, unique_id, mode = "a+", symlink_path = nil) ⇒ PullBufferChunk

Returns a new instance of PullBufferChunk.



7
8
9
10
# File 'lib/fluent/plugin/buf_pullpool.rb', line 7

def initialize(key, path, unique_id, mode="a+", symlink_path = nil)
  super
  @flushed = false
end

Instance Attribute Details

#flushedObject

Returns the value of attribute flushed.



5
6
7
# File 'lib/fluent/plugin/buf_pullpool.rb', line 5

def flushed
  @flushed
end

Instance Method Details

#actual_purgeObject



19
20
21
22
# File 'lib/fluent/plugin/buf_pullpool.rb', line 19

def actual_purge
  @file.close
  File.unlink(@path) rescue nil # TODO: check @path exists or not, and remove-or-rename if exists
end

#purgeObject



12
13
14
15
16
17
# File 'lib/fluent/plugin/buf_pullpool.rb', line 12

def purge
  # do not anything if not flushed yet: call actual_purge explicitly.
  if @flushed
    actual_purge
  end
end