Class: Fluent::TailInput::FilePositionEntry
- Inherits:
-
Object
- Object
- Fluent::TailInput::FilePositionEntry
- Defined in:
- lib/fluent/plugin/in_tail.rb
Overview
pos inode fffffffffffffffftffffffffffffffffn
Constant Summary collapse
- POS_SIZE =
16- INO_OFFSET =
17- INO_SIZE =
16- LN_OFFSET =
33- SIZE =
34
Instance Method Summary collapse
-
#initialize(file, seek) ⇒ FilePositionEntry
constructor
A new instance of FilePositionEntry.
- #read_inode ⇒ Object
- #read_pos ⇒ Object
- #update(ino, pos) ⇒ Object
- #update_pos(pos) ⇒ Object
Constructor Details
#initialize(file, seek) ⇒ FilePositionEntry
Returns a new instance of FilePositionEntry.
784 785 786 787 |
# File 'lib/fluent/plugin/in_tail.rb', line 784 def initialize(file, seek) @file = file @seek = seek end |
Instance Method Details
#read_inode ⇒ Object
799 800 801 802 803 |
# File 'lib/fluent/plugin/in_tail.rb', line 799 def read_inode @file.pos = @seek + INO_OFFSET raw = @file.read(16) raw ? raw.to_i(16) : 0 end |
#read_pos ⇒ Object
805 806 807 808 809 |
# File 'lib/fluent/plugin/in_tail.rb', line 805 def read_pos @file.pos = @seek raw = @file.read(16) raw ? raw.to_i(16) : 0 end |
#update(ino, pos) ⇒ Object
789 790 791 792 |
# File 'lib/fluent/plugin/in_tail.rb', line 789 def update(ino, pos) @file.pos = @seek @file.write "%016x\t%016x" % [pos, ino] end |
#update_pos(pos) ⇒ Object
794 795 796 797 |
# File 'lib/fluent/plugin/in_tail.rb', line 794 def update_pos(pos) @file.pos = @seek @file.write "%016x" % pos end |