Module: Wal::Watcher

Overview

Watcher is the core API used to hook into Postgres WAL log. The only required method on the API is the ‘on_event`, which will receive a WAL entry of the following events:

  • Transaction started: ‘Wal::BeginTransactionEvent`

  • Row inserted: ‘Wal::InsertEvent`

  • Row updated: ‘Wal::UpdateEvent`

  • Row deleted: ‘Wal::DeleteEvent`

  • Transaction committed: ‘Wal::CommitTransactionEvent`

The ‘on_event` method will be called without any buffering, so it is up to implementators to aggregate them if desired. In practice, it is rarelly useful to implement this module directly for application level business logic, and instead it is more recomended using more specific ones, such as the `RecordWatcher` and `StreamingWalWatcher`.

Defined Under Namespace

Modules: SeparatedEvents

Instance Method Summary collapse

Instance Method Details

#on_event(event) ⇒ Object



14
# File 'lib/wal/watcher.rb', line 14

def on_event(event); end

#should_watch_table?(table) ⇒ Boolean

Allows dropping the processing of any table

Returns:

  • (Boolean)


17
18
19
# File 'lib/wal/watcher.rb', line 17

def should_watch_table?(table)
  true
end

#valid_context_prefix?(prefix) ⇒ Boolean

Check if the given context prefix should be allowed for this watcher

Returns:

  • (Boolean)


22
23
24
# File 'lib/wal/watcher.rb', line 22

def valid_context_prefix?(prefix)
  true
end