Class: Fluent::Plugin::TailInput::TailWatcher::IOHandler
- Inherits:
-
Object
- Object
- Fluent::Plugin::TailInput::TailWatcher::IOHandler
- Defined in:
- lib/fluent/plugin/in_tail.rb
Constant Summary collapse
- BYTES_TO_READ =
8192- SHUTDOWN_TIMEOUT =
5
Instance Attribute Summary collapse
-
#shutdown_timeout ⇒ Object
Returns the value of attribute shutdown_timeout.
Instance Method Summary collapse
- #close ⇒ Object
- #eof? ⇒ Boolean
- #group_watcher ⇒ Object
-
#initialize(watcher, path:, read_lines_limit:, read_bytes_limit_per_second:, max_line_size: nil, log:, open_on_every_update:, encoding: Encoding::ASCII_8BIT, encoding_to_convert: nil, metrics:, &receive_lines) ⇒ IOHandler
constructor
A new instance of IOHandler.
- #on_notify ⇒ Object
- #opened? ⇒ Boolean
- #ready_to_shutdown(shutdown_start_time = nil) ⇒ Object
Constructor Details
#initialize(watcher, path:, read_lines_limit:, read_bytes_limit_per_second:, max_line_size: nil, log:, open_on_every_update:, encoding: Encoding::ASCII_8BIT, encoding_to_convert: nil, metrics:, &receive_lines) ⇒ IOHandler
Returns a new instance of IOHandler.
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 |
# File 'lib/fluent/plugin/in_tail.rb', line 1133 def initialize(watcher, path:, read_lines_limit:, read_bytes_limit_per_second:, max_line_size: nil, log:, open_on_every_update:, encoding: Encoding::ASCII_8BIT, encoding_to_convert: nil, metrics:, &receive_lines) @watcher = watcher @path = path @read_lines_limit = read_lines_limit @read_bytes_limit_per_second = read_bytes_limit_per_second @receive_lines = receive_lines @open_on_every_update = open_on_every_update @encoding = encoding @fifo = FIFO.new(encoding, log, max_line_size, encoding_to_convert) @lines = [] @io = nil @notify_mutex = Mutex.new @log = log @start_reading_time = nil @number_bytes_read = 0 @shutdown_start_time = nil @shutdown_timeout = SHUTDOWN_TIMEOUT @shutdown_mutex = Mutex.new @eof = false @metrics = metrics @log.info "following tail of #{@path}" end |
Instance Attribute Details
#shutdown_timeout ⇒ Object
Returns the value of attribute shutdown_timeout.
1131 1132 1133 |
# File 'lib/fluent/plugin/in_tail.rb', line 1131 def shutdown_timeout @shutdown_timeout end |
Instance Method Details
#close ⇒ Object
1172 1173 1174 1175 1176 1177 1178 |
# File 'lib/fluent/plugin/in_tail.rb', line 1172 def close if @io && !@io.closed? @io.close @io = nil @metrics.closed.inc end end |
#eof? ⇒ Boolean
1184 1185 1186 |
# File 'lib/fluent/plugin/in_tail.rb', line 1184 def eof? @eof end |
#group_watcher ⇒ Object
1157 1158 1159 |
# File 'lib/fluent/plugin/in_tail.rb', line 1157 def group_watcher @watcher.group_watcher end |
#on_notify ⇒ Object
1161 1162 1163 |
# File 'lib/fluent/plugin/in_tail.rb', line 1161 def on_notify @notify_mutex.synchronize { handle_notify } end |
#opened? ⇒ Boolean
1180 1181 1182 |
# File 'lib/fluent/plugin/in_tail.rb', line 1180 def opened? !!@io end |