class LogStash::PluginMixins::Jdbc::ValueTracking
Attributes
value[R]
Public Class Methods
build_last_value_tracker(plugin)
click to toggle source
# File lib/logstash/plugin_mixins/jdbc/value_tracking.rb, line 7 def self.build_last_value_tracker(plugin) handler = plugin.record_last_run ? FileHandler.new(plugin.last_run_metadata_path) : NullFileHandler.new(plugin.last_run_metadata_path) if plugin.record_last_run handler = FileHandler.new(plugin.last_run_metadata_path) end if plugin.clean_run handler.clean end if plugin.use_column_value && plugin.tracking_column_type == "numeric" # use this irrespective of the jdbc_default_timezone setting NumericValueTracker.new(handler) else if plugin.jdbc_default_timezone.nil? || plugin.jdbc_default_timezone.empty? # no TZ stuff for Sequel, use Time TimeValueTracker.new(handler) else # Sequel does timezone handling on DateTime only DateTimeValueTracker.new(handler) end end end
new(handler)
click to toggle source
# File lib/logstash/plugin_mixins/jdbc/value_tracking.rb, line 32 def initialize(handler) @file_handler = handler set_initial end
Public Instance Methods
set_initial()
click to toggle source
# File lib/logstash/plugin_mixins/jdbc/value_tracking.rb, line 37 def set_initial # override in subclass end
set_value(value)
click to toggle source
# File lib/logstash/plugin_mixins/jdbc/value_tracking.rb, line 41 def set_value(value) # override in subclass end
write()
click to toggle source
# File lib/logstash/plugin_mixins/jdbc/value_tracking.rb, line 45 def write @file_handler.write(@value) end
Private Instance Methods
common_set_initial(method_symbol, default)
click to toggle source
# File lib/logstash/plugin_mixins/jdbc/value_tracking.rb, line 50 def common_set_initial(method_symbol, default) persisted = @file_handler.read if persisted && persisted.respond_to?(method_symbol) @value = persisted else @file_handler.clean @value = default end end