module FileWatch
Common setup all the required constants and files defined in one place
Interface API topology
ObservingBase
module (this file)
is a module mixin proving common constructor and external API for File Input Plugin interaction calls build_specific_processor on ObservingRead or ObservingTail
ObservingRead
and ObservingTail
provides the External API method subscribe(observer = NullObserver.new) build_specific_processor(settings) - provide a Tail or Read specific Processor.
TailMode::Processor
or ReadMode::Processor
initialize_handlers(sincedb_collection, observer) - called when the observer subscribes to changes in a Mode, builds mode specific handler instances with references to the observer process_closed(watched_files) - provide specific processing of watched_files in the closed state process_ignored(watched_files) - provide specific processing of watched_files in the ignored state process_watched(watched_files) - provide specific processing of watched_files in the watched state process_active(watched_files) - provide specific processing of watched_files in the active state These methods can call "handler" methods that delegate to the specific Handler classes.
TailMode::Handlers
module namespace
contains the Handler classes that deals with Tail mode file lifecycle "events". The TailMode::Handlers::Base handle(watched_file) - this method calls handle_specifically defined in a subclass handle_specifically(watched_file) - this is a noop method update_existing_specifically(watched_file, sincedb_value) - this is a noop method Each handler extends the Base class to provide specific implementations of these two methods: handle_specifically(watched_file) update_existing_specifically(watched_file, sincedb_value)
ReadMode::Handlers
module namespace
contains the Handler classes that deals with Read mode file lifecycle "events". The ReadMode::Handlers::Base handle(watched_file) - this method calls handle_specifically defined in a subclass handle_specifically(watched_file) - this is a noop method Each handler extends the Base class to provide specific implementations of this method: handle_specifically(watched_file)
Constants
- BufferExtractResult
- FILE_READ_SIZE
the number of bytes read from a file during the read phase
- FileOpener
- InodeStruct
Structs can be used as hash keys because they compare by value this is used as the key for values in the sincedb hash
- MAX_FILES_WARN_INTERVAL
- MAX_ITERATIONS
the largest fixnum in ruby this is used in the read loop e.g. @opts.times do where file_chunk_count defaults to this constant
- OPEN_WARN_INTERVAL
how often (in seconds) we logger.warn a failed file open, per path.
- PathStatClass