Class: Flydata::SourceMysql::PluginSupport::BinlogRecordHandler

Inherits:
Object
  • Object
show all
Includes:
PluginSupport::SyncRecordEmittable
Defined in:
lib/flydata/source_mysql/plugin_support/binlog_record_handler.rb

Direct Known Subclasses

BinlogQueryHandler, DmlRecordHandler

Constant Summary

Constants included from PluginSupport::SyncRecordEmittable

PluginSupport::SyncRecordEmittable::RESPECT_ORDER, PluginSupport::SyncRecordEmittable::SEQ, PluginSupport::SyncRecordEmittable::SRC_POS, PluginSupport::SyncRecordEmittable::TABLE_NAME, PluginSupport::SyncRecordEmittable::TABLE_REV, PluginSupport::SyncRecordEmittable::TYPE, PluginSupport::SyncRecordEmittable::V

Instance Attribute Summary

Attributes included from PluginSupport::SyncRecordEmittable

#context

Instance Method Summary collapse

Methods included from PluginSupport::SyncRecordEmittable

#emit_sync_records

Constructor Details

#initialize(context) ⇒ BinlogRecordHandler

Returns a new instance of BinlogRecordHandler.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/flydata/source_mysql/plugin_support/binlog_record_handler.rb', line 13

def initialize(context)
  @context = context
  @first_empty_binlog = true
  @table_meta = @context.table_meta

  # Load per-table binlog position
  @table_binlog_pos = {}
  @context.tables.each do |table_name|
    table_binlog_pos_str = @context.sync_fm.get_table_source_raw_pos(table_name)
    if table_binlog_pos_str
      @table_binlog_pos[table_name] = FlydataCore::Mysql::BinlogPos.new(table_binlog_pos_str)
    end
  end
end