Module: Pgoutput::Client::Commands Private
- Defined in:
- lib/pgoutput/client/commands.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
SQL command builders for PostgreSQL replication-mode commands.
PostgreSQL replication commands are issued on a connection opened with the
replication parameter enabled. The methods in this module render the small
command subset needed by pgoutput-client and rely on Configuration to
validate identifier-like values before interpolation.
Class Method Summary collapse
-
.create_replication_slot(configuration) ⇒ String
private
Render a
CREATE_REPLICATION_SLOTcommand. -
.drop_replication_slot(configuration) ⇒ String
private
Render a
DROP_REPLICATION_SLOTcommand. -
.start_replication(configuration) ⇒ String
private
Render a `START_REPLICATION SLOT ...
Class Method Details
.create_replication_slot(configuration) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Render a CREATE_REPLICATION_SLOT command.
Temporary slots are requested only when Pgoutput::Client::Configuration#temporary_slot is true.
27 28 29 30 |
# File 'lib/pgoutput/client/commands.rb', line 27 def create_replication_slot(configuration) temporary = configuration.temporary_slot ? " TEMPORARY" : "" "CREATE_REPLICATION_SLOT #{configuration.slot_name}#{temporary} LOGICAL #{configuration.plugin}" end |
.drop_replication_slot(configuration) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Render a DROP_REPLICATION_SLOT command.
36 37 38 |
# File 'lib/pgoutput/client/commands.rb', line 36 def drop_replication_slot(configuration) "DROP_REPLICATION_SLOT #{configuration.slot_name}" end |
.start_replication(configuration) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Render a START_REPLICATION SLOT ... LOGICAL ... command.
The command includes the pgoutput options required by PostgreSQL:
proto_version and publication_names. Optional pgoutput switches such
as binary and messages are emitted only when enabled.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/pgoutput/client/commands.rb', line 48 def start_replication(configuration) = { "proto_version" => configuration.proto_version.to_s, "publication_names" => configuration.publication_names.join(","), "binary" => configuration.binary ? "true" : nil, "messages" => configuration. ? "true" : nil }.compact = .map { |key, value| %("#{key}" '#{value}') }.join(", ") "START_REPLICATION SLOT #{configuration.slot_name} LOGICAL #{configuration.start_lsn_string} (#{})" end |