Module: FileWatch

Defined in:
lib/filewatch/bootstrap.rb,
lib/filewatch/watch.rb,
lib/filewatch/settings.rb,
lib/filewatch/processor.rb,
lib/filewatch/discoverer.rb,
lib/filewatch/stat/generic.rb,
lib/filewatch/watched_file.rb,
lib/filewatch/sincedb_value.rb,
lib/filewatch/observing_base.rb,
lib/filewatch/observing_read.rb,
lib/filewatch/observing_tail.rb,
lib/filewatch/stat/windows_path.rb,
lib/filewatch/sincedb_collection.rb,
lib/filewatch/read_mode/processor.rb,
lib/filewatch/tail_mode/processor.rb,
lib/filewatch/read_mode/handlers/base.rb,
lib/filewatch/tail_mode/handlers/base.rb,
lib/filewatch/tail_mode/handlers/grow.rb,
lib/filewatch/watched_files_collection.rb,
lib/filewatch/sincedb_record_serializer.rb,
lib/filewatch/tail_mode/handlers/create.rb,
lib/filewatch/tail_mode/handlers/delete.rb,
lib/filewatch/tail_mode/handlers/shrink.rb,
lib/filewatch/tail_mode/handlers/timeout.rb,
lib/filewatch/tail_mode/handlers/unignore.rb,
lib/filewatch/read_mode/handlers/read_file.rb,
lib/filewatch/read_mode/handlers/read_zip_file.rb,
lib/filewatch/tail_mode/handlers/create_initial.rb

Overview

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)

Defined Under Namespace

Modules: ObservingBase, ReadMode, Stat, TailMode Classes: BufferExtractResult, Discoverer, InodeStruct, LoopControlResult, NoSinceDBPathGiven, ObservingRead, ObservingTail, Processor, Settings, SincedbCollection, SincedbRecordSerializer, SincedbValue, Watch, WatchedFile, WatchedFilesCollection

Constant Summary collapse

FILE_READ_SIZE =

the number of bytes read from a file during the read phase

32768
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

(2**(0.size * 8 - 2) - 2) / 32768
PathStatClass =
Stat::Generic
FileOpener =
::File
OPEN_WARN_INTERVAL =

how often (in seconds) we logger.warn a failed file open, per path.

ENV.fetch("FILEWATCH_OPEN_WARN_INTERVAL", 300).to_i
MAX_FILES_WARN_INTERVAL =
ENV.fetch("FILEWATCH_MAX_FILES_WARN_INTERVAL", 20).to_i