Class: Fluent::TailPathInput::FilePositionEntry
- Inherits:
-
Object
- Object
- Fluent::TailPathInput::FilePositionEntry
- Defined in:
- lib/fluent/plugin/in_tailpath.rb
Overview
pos inode fffffffffffffffftffffffffn
Constant Summary collapse
- POS_SIZE =
16- INO_OFFSET =
17- INO_SIZE =
8- LN_OFFSET =
25- SIZE =
26
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.
444 445 446 447 |
# File 'lib/fluent/plugin/in_tailpath.rb', line 444 def initialize(file, seek) @file = file @seek = seek end |
Instance Method Details
#read_inode ⇒ Object
460 461 462 463 464 |
# File 'lib/fluent/plugin/in_tailpath.rb', line 460 def read_inode @file.pos = @seek + INO_OFFSET raw = @file.read(8) raw ? raw.to_i(16) : 0 end |
#read_pos ⇒ Object
466 467 468 469 470 |
# File 'lib/fluent/plugin/in_tailpath.rb', line 466 def read_pos @file.pos = @seek raw = @file.read(16) raw ? raw.to_i(16) : 0 end |
#update(ino, pos) ⇒ Object
449 450 451 452 453 |
# File 'lib/fluent/plugin/in_tailpath.rb', line 449 def update(ino, pos) @file.pos = @seek @file.write "%016x\t%08x" % [pos, ino] @inode = ino end |
#update_pos(pos) ⇒ Object
455 456 457 458 |
# File 'lib/fluent/plugin/in_tailpath.rb', line 455 def update_pos(pos) @file.pos = @seek @file.write "%016x" % pos end |