Class: Fluent::Plugin::TailInput::FilePositionEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/in_tail/position_file.rb

Overview

pos inode fffffffffffffffftffffffffffffffffn

Constant Summary collapse

POS_SIZE =
16
INO_OFFSET =
17
INO_SIZE =
16
LN_OFFSET =
33
SIZE =
34

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, file_mutex, seek, pos, inode) ⇒ FilePositionEntry

Returns a new instance of FilePositionEntry.



191
192
193
194
195
196
197
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 191

def initialize(file, file_mutex, seek, pos, inode)
  @file = file
  @file_mutex = file_mutex
  @seek = seek
  @pos = pos
  @inode = inode
end

Instance Attribute Details

#seek=(value) ⇒ Object (writeonly)

Sets the attribute seek

Parameters:

  • value

    the value to set the attribute seek to.



199
200
201
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 199

def seek=(value)
  @seek = value
end

Instance Method Details

#read_inodeObject



218
219
220
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 218

def read_inode
  @inode
end

#read_posObject



222
223
224
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 222

def read_pos
  @pos
end

#update(ino, pos) ⇒ Object



201
202
203
204
205
206
207
208
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 201

def update(ino, pos)
  @file_mutex.synchronize {
    @file.pos = @seek
    @file.write "%016x\t%016x" % [pos, ino]
  }
  @pos = pos
  @inode = ino
end

#update_pos(pos) ⇒ Object



210
211
212
213
214
215
216
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 210

def update_pos(pos)
  @file_mutex.synchronize {
    @file.pos = @seek
    @file.write "%016x" % pos
  }
  @pos = pos
end