Class: FileWatch::TailMode::Processor
- Defined in:
- lib/filewatch/tail_mode/processor.rb
Overview
Must handle
:create_initial - file is discovered and we have no record of it in the sincedb
:create - file is discovered and we have seen it before in the sincedb
:grow - file has more content
:shrink - file has less content
:delete - file can't be read
:timeout - file is closable
:unignore - file was ignored, but have now received new content
Instance Attribute Summary
Attributes inherited from Processor
Instance Method Summary collapse
- #create(watched_file) ⇒ Object
- #create_initial(watched_file) ⇒ Object
- #delete(watched_file) ⇒ Object
- #grow(watched_file) ⇒ Object
- #initialize_handlers(sincedb_collection, observer) ⇒ Object
- #process_all_states(watched_files) ⇒ Object
- #shrink(watched_file) ⇒ Object
- #timeout(watched_file) ⇒ Object
- #unignore(watched_file) ⇒ Object
Methods inherited from Processor
#add_deletable_path, #add_watch, #clear_deletable_paths, #initialize, #restat
Constructor Details
This class inherits a constructor from FileWatch::Processor
Instance Method Details
#create(watched_file) ⇒ Object
34 35 36 |
# File 'lib/filewatch/tail_mode/processor.rb', line 34 def create(watched_file) @create.handle(watched_file) end |
#create_initial(watched_file) ⇒ Object
38 39 40 |
# File 'lib/filewatch/tail_mode/processor.rb', line 38 def create_initial(watched_file) @create_initial.handle(watched_file) end |
#delete(watched_file) ⇒ Object
50 51 52 |
# File 'lib/filewatch/tail_mode/processor.rb', line 50 def delete(watched_file) @delete.handle(watched_file) end |
#grow(watched_file) ⇒ Object
42 43 44 |
# File 'lib/filewatch/tail_mode/processor.rb', line 42 def grow(watched_file) @grow.handle(watched_file) end |
#initialize_handlers(sincedb_collection, observer) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/filewatch/tail_mode/processor.rb', line 23 def initialize_handlers(sincedb_collection, observer) @sincedb_collection = sincedb_collection @create_initial = Handlers::CreateInitial.new(self, sincedb_collection, observer, @settings) @create = Handlers::Create.new(self, sincedb_collection, observer, @settings) @grow = Handlers::Grow.new(self, sincedb_collection, observer, @settings) @shrink = Handlers::Shrink.new(self, sincedb_collection, observer, @settings) @delete = Handlers::Delete.new(self, sincedb_collection, observer, @settings) @timeout = Handlers::Timeout.new(self, sincedb_collection, observer, @settings) @unignore = Handlers::Unignore.new(self, sincedb_collection, observer, @settings) end |
#process_all_states(watched_files) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/filewatch/tail_mode/processor.rb', line 62 def process_all_states(watched_files) process_closed(watched_files) return if watch.quit? process_ignored(watched_files) return if watch.quit? process_delayed_delete(watched_files) return if watch.quit? process_restat_for_watched_and_active(watched_files) return if watch.quit? process_rotation_in_progress(watched_files) return if watch.quit? process_watched(watched_files) return if watch.quit? process_active(watched_files) end |
#shrink(watched_file) ⇒ Object
46 47 48 |
# File 'lib/filewatch/tail_mode/processor.rb', line 46 def shrink(watched_file) @shrink.handle(watched_file) end |
#timeout(watched_file) ⇒ Object
54 55 56 |
# File 'lib/filewatch/tail_mode/processor.rb', line 54 def timeout(watched_file) @timeout.handle(watched_file) end |
#unignore(watched_file) ⇒ Object
58 59 60 |
# File 'lib/filewatch/tail_mode/processor.rb', line 58 def unignore(watched_file) @unignore.handle(watched_file) end |