Class: Fluent::MysqlBinlogInput::BinlogUtil
- Inherits:
-
Object
- Object
- Fluent::MysqlBinlogInput::BinlogUtil
- Defined in:
- lib/fluent/plugin/in_mysql_binlog.rb
Constant Summary collapse
- EVENT_TYPES =
%w(query_event rotate_event int_var_event user_var_event format_event xid table_map_event row_event incident_event unimplemented_event)
- TYPE_ATTRIBUTES =
{ base: %w(marker timestamp type_code server_id event_length next_position flags event_type), format_event: %w(binlog_version created_ts log_header_len), incident_event: %w(incident_type message), int_var_event: %w(var_type value), query_event: %w(thread_id exec_time error_code variables db_name query), rotate_event: %w(binlog_file binlog_pos), row_event: %w(table_id db_name table_name columns columns_len null_bits_len raw_columns_before_image raw_used_columns raw_row rows), table_map_event: %w(table_id db_name table_name raw_columns columns metadata null_bits), unimplemented_event: nil, user_var_event: %w(name is_null var_type charset value), xid: %w(xid_id), }
Class Method Summary collapse
Class Method Details
.attributes_for(event) ⇒ Object
92 93 94 95 96 97 |
# File 'lib/fluent/plugin/in_mysql_binlog.rb', line 92 def attributes_for(event) event_type = ActiveSupport::Inflector.underscore( ActiveSupport::Inflector.demodulize(event.class) ).gsub(/^on_/, '') TYPE_ATTRIBUTES[:base] + (TYPE_ATTRIBUTES[event_type.to_sym] || []) end |
.to_hash(event) ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/fluent/plugin/in_mysql_binlog.rb', line 84 def to_hash(event) Hash[ attributes_for(event).map do |attr| [attr, event.send(attr.to_sym)] rescue nil end ] end |