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.
207 208 209 210 211 212 213 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 207 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
215 216 217 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 215 def seek=(value) @seek = value end |
Instance Method Details
#read_inode ⇒ Object
234 235 236 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 234 def read_inode @inode end |
#read_pos ⇒ Object
238 239 240 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 238 def read_pos @pos end |
#update(ino, pos) ⇒ Object
217 218 219 220 221 222 223 224 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 217 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
226 227 228 229 230 231 232 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 226 def update_pos(pos) @file_mutex.synchronize { @file.pos = @seek @file.write "%016x" % pos } @pos = pos end |