Class: FileWatch::TailMode::Handlers::Shrink
- Inherits:
-
Base
- Object
- Base
- FileWatch::TailMode::Handlers::Shrink
show all
- Defined in:
- lib/filewatch/tail_mode/handlers/shrink.rb
Instance Attribute Summary
Attributes inherited from Base
#sincedb_collection
Instance Method Summary
collapse
Methods inherited from Base
#handle, #initialize, #quit?
Instance Method Details
#handle_specifically(watched_file) ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/filewatch/tail_mode/handlers/shrink.rb', line 5
def handle_specifically(watched_file)
add_or_update_sincedb_collection(watched_file)
watched_file.file_seek(watched_file.bytes_read)
loop do
break if quit?
loop_control = watched_file.loop_control_adjusted_for_stat_size
controlled_read(watched_file, loop_control)
break unless loop_control.keep_looping?
end
end
|
#update_existing_specifically(watched_file, sincedb_value) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/filewatch/tail_mode/handlers/shrink.rb', line 16
def update_existing_specifically(watched_file, sincedb_value)
watched_file.reset_bytes_unread
sincedb_value.update_position(0)
logger.trace? && logger.trace("update_existing_specifically: was truncated seeking to beginning", :watched_file => watched_file.details, :sincedb_value => sincedb_value)
end
|