Class: MysqlReplicator::Binlogs::FormatDescriptionEventParser

Inherits:
Object
  • Object
show all
Defined in:
lib/mysql_replicator/binlogs/format_description_event_parser.rb

Class Method Summary collapse

Class Method Details

.parse(payload) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/mysql_replicator/binlogs/format_description_event_parser.rb', line 12

def self.parse(payload)
  binlog_version = MysqlReplicator::StringUtil.read_uint16(payload[0, 2])
  server_version = if payload.length >= 52
                     MysqlReplicator::StringUtil.read_str(payload[2, 50]).strip.gsub("\x00", '')
                   else
                     ''
                   end

  { binlog_version: binlog_version, server_version: server_version }
end