Class: Fluent::Plugin::TailInput::FilePositionEntry
- Inherits:
-
Object
- Object
- Fluent::Plugin::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.
848 849 850 851 852 |
# File 'lib/fluent/plugin/in_tail.rb', line 848 def initialize(file, seek) @file = file @seek = seek @pos = nil end |
Instance Method Details
#read_inode ⇒ Object
866 867 868 869 870 |
# File 'lib/fluent/plugin/in_tail.rb', line 866 def read_inode @file.pos = @seek + INO_OFFSET raw = @file.read(16) raw ? raw.to_i(16) : 0 end |
#read_pos ⇒ Object
872 873 874 875 876 877 878 |
# File 'lib/fluent/plugin/in_tail.rb', line 872 def read_pos @pos ||= begin @file.pos = @seek raw = @file.read(16) raw ? raw.to_i(16) : 0 end end |
#update(ino, pos) ⇒ Object
854 855 856 857 858 |
# File 'lib/fluent/plugin/in_tail.rb', line 854 def update(ino, pos) @file.pos = @seek @file.write "%016x\t%016x" % [pos, ino] @pos = pos end |
#update_pos(pos) ⇒ Object
860 861 862 863 864 |
# File 'lib/fluent/plugin/in_tail.rb', line 860 def update_pos(pos) @file.pos = @seek @file.write "%016x" % pos @pos = pos end |