Class: Fluent::Plugin::TailInput::FilePositionEntry
- Inherits:
-
Object
- Object
- Fluent::Plugin::TailInput::FilePositionEntry
- 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
-
#seek ⇒ Object
writeonly
Sets the attribute seek.
Instance Method Summary collapse
-
#initialize(file, file_mutex, seek, pos, inode) ⇒ 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, 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
199 200 201 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 199 def seek=(value) @seek = value end |
Instance Method Details
#read_inode ⇒ Object
218 219 220 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 218 def read_inode @inode end |
#read_pos ⇒ Object
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 |