class Fluent::SQLInput::StateStore
Public Class Methods
new(path)
click to toggle source
# File lib/fluent/plugin/in_sql.rb, line 270 def initialize(path) require 'yaml' @path = path if File.exists?(@path) @data = YAML.load_file(@path) if @data == false || @data == [] # this happens if an users created an empty file accidentally @data = {} elsif !@data.is_a?(Hash) raise "state_file on #{@path.inspect} is invalid" end else @data = {} end end
Public Instance Methods
last_records()
click to toggle source
# File lib/fluent/plugin/in_sql.rb, line 287 def last_records @data['last_records'] ||= {} end
update!()
click to toggle source
# File lib/fluent/plugin/in_sql.rb, line 291 def update! File.open(@path, 'w') {|f| f.write YAML.dump(@data) } end