Sha256: a74c3ed20df096baef14c705af7e4b078b14d2fc3f5a77f05fed4bc3820383ee

Contents?: true

Size: 581 Bytes

Versions: 6

Compression:

Stored size: 581 Bytes

Contents

require "ecco/event_listener"

module Ecco
  class SaveEventListener < EventListener
    SAVE_EVENTS = [
      EventType::QUERY,
      EventType::ROTATE,
      EventType::WRITE_ROWS,
      EventType::UPDATE_ROWS,
      EventType::DELETE_ROWS,
    ]

    def accepted_events
      SAVE_EVENTS
    end

    def on_event(event)
      type = event.get_header.get_event_type

      case type
      when *accepted_events
        filename = @client.get_binlog_filename
        position = @client.get_binlog_position

        @callback.call(filename, position)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ecco-0.6.0-java lib/ecco/save_event_listener.rb
ecco-0.5.0-java lib/ecco/save_event_listener.rb
ecco-0.4.1-java lib/ecco/save_event_listener.rb
ecco-0.4.0-java lib/ecco/save_event_listener.rb
ecco-0.3.1-java lib/ecco/save_event_listener.rb
ecco-0.3.0-java lib/ecco/save_event_listener.rb