require 'flydata/plugin_support/context' require 'flydata-core/mysql/binlog_pos' module Flydata module SourceMysql module PluginSupport class Context < ::Flydata::PluginSupport::Context register_mandatory_opts :database def initialize(opts) super set_table_binlog_pos end attr_reader :table_binlog_pos def set_table_binlog_pos @table_binlog_pos = {} tables.each do |table_name| table_binlog_pos_str = sync_fm.get_table_source_raw_pos(table_name) if table_binlog_pos_str @table_binlog_pos[table_name] = ::FlydataCore::Mysql::BinlogPos.load(table_binlog_pos_str) end end end def set_infinity_to_table_binlog_pos(table_name) new_src_pos = FlydataCore::Mysql::BinlogPos.infinity_src_pos sync_fm.save_table_source_pos(table_name, new_src_pos, destination: :positions) @table_binlog_pos[table_name] = new_src_pos end end end end end