Class: Pgoutput::Client::SlotStatus

Inherits:
SlotStatusData show all
Defined in:
lib/pgoutput/client/slot_status.rb,
sig/pgoutput/client/slot_status.rbs

Overview

Typed replication-slot catalog snapshot.

Instance Attribute Summary

Attributes inherited from SlotStatusData

#active, #active_pid, #catalog_xmin, #confirmed_flush_lsn, #conflicting, #database, #inactive_since, #invalidation_reason, #plugin, #restart_lsn, #safe_wal_size, #slot_name, #slot_type, #wal_status

Class Method Summary collapse

Methods inherited from SlotStatusData

new

Class Method Details

.from_catalog(attributes) ⇒ SlotStatus

Build a snapshot from a pg_replication_slots JSON object.

Parameters:

  • attributes (Hash{String, Symbol=>Object})

    catalog attributes

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/pgoutput/client/slot_status.rb', line 38

def self.from_catalog(attributes)
  fetch = lambda do |key|
    next attributes[key] if attributes.key?(key)

    attributes[key.to_sym]
  end

  new(
    slot_name: fetch.call("slot_name"),
    plugin: fetch.call("plugin"),
    slot_type: fetch.call("slot_type"),
    database: fetch.call("database"),
    active: fetch.call("active") == true,
    active_pid: fetch.call("active_pid"),
    catalog_xmin: fetch.call("catalog_xmin"),
    restart_lsn: fetch.call("restart_lsn"),
    confirmed_flush_lsn: fetch.call("confirmed_flush_lsn"),
    wal_status: fetch.call("wal_status"),
    safe_wal_size: fetch.call("safe_wal_size"),
    inactive_since: fetch.call("inactive_since"),
    conflicting: fetch.call("conflicting"),
    invalidation_reason: fetch.call("invalidation_reason")
  )
end