Class: Ecco::SaveEventListener
Constant Summary
collapse
- SAVE_EVENTS =
{
EventType::QUERY => "QUERY",
EventType::ROTATE => "ROTATE",
EventType::WRITE_ROWS => "WRITE_ROWS",
EventType::EXT_WRITE_ROWS => "WRITE_ROWS",
EventType::UPDATE_ROWS => "UPDATE_ROWS",
EventType::EXT_UPDATE_ROWS => "UPDATE_ROWS",
EventType::DELETE_ROWS => "DELETE_ROWS",
EventType::EXT_DELETE_ROWS => "DELETE_ROWS",
}
Instance Attribute Summary
#callback
Instance Method Summary
collapse
#initialize
Instance Method Details
#accepted_events ⇒ Object
16
17
18
|
# File 'lib/ecco/save_event_listener.rb', line 16
def accepted_events
SAVE_EVENTS.keys
end
|
#on_event(event) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/ecco/save_event_listener.rb', line 20
def on_event(event)
type = event..get_event_type
case type
when *accepted_events
filename = @client.get_binlog_filename
position = @client.get_binlog_position
event_type_name = SAVE_EVENTS.fetch(type)
@callback.call(filename, position, event_type_name)
end
end
|