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.
193 194 195 196 197 198 199 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 193 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
201 202 203 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 201 def seek=(value) @seek = value end |
Instance Method Details
#read_inode ⇒ Object
220 221 222 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 220 def read_inode @inode end |
#read_pos ⇒ Object
224 225 226 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 224 def read_pos @pos end |
#update(ino, pos) ⇒ Object
203 204 205 206 207 208 209 210 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 203 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
212 213 214 215 216 217 218 |
# File 'lib/fluent/plugin/in_tail/position_file.rb', line 212 def update_pos(pos) @file_mutex.synchronize { @file.pos = @seek @file.write "%016x" % pos } @pos = pos end |