Class: Flydata::SourceMysql::PluginSupport::Context

Inherits:
PluginSupport::Context show all
Defined in:
lib/flydata/source_mysql/plugin_support/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from PluginSupport::Context

mandatory_opts, optional_opts, register_mandatory_opts, register_optional_opts, #source_pos_class

Constructor Details

#initialize(opts) ⇒ Context

Returns a new instance of Context.


11
12
13
14
# File 'lib/flydata/source_mysql/plugin_support/context.rb', line 11

def initialize(opts)
  super
  set_table_binlog_pos
end

Instance Attribute Details

#table_binlog_posObject (readonly)

Returns the value of attribute table_binlog_pos


16
17
18
# File 'lib/flydata/source_mysql/plugin_support/context.rb', line 16

def table_binlog_pos
  @table_binlog_pos
end

Instance Method Details

#set_infinity_to_table_binlog_pos(table_name) ⇒ Object


28
29
30
31
32
# File 'lib/flydata/source_mysql/plugin_support/context.rb', line 28

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

#set_table_binlog_posObject


18
19
20
21
22
23
24
25
26
# File 'lib/flydata/source_mysql/plugin_support/context.rb', line 18

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