Formatting and docs corrections for logical decoding output plugins.
authorTom Lane <[email protected]>
Wed, 15 Feb 2017 23:15:47 +0000 (18:15 -0500)
committerTom Lane <[email protected]>
Wed, 15 Feb 2017 23:15:47 +0000 (18:15 -0500)
Make the typedefs for output plugins consistent with project style;
they were previously not even consistent with each other as to layout
or inclusion of parameter names.  Make the documentation look the same,
and fix errors therein (missing and misdescribed parameters).

Back-patch because of the documentation bugs.

doc/src/sgml/logicaldecoding.sgml
src/include/replication/output_plugin.h

index 6d7bd51b29b489f93d68a9f64a4fda82a7a8d177..59dd84a7b6ffc693e16b3f8fd4604c6f383d0ece 100644 (file)
@@ -367,7 +367,7 @@ typedef struct OutputPluginCallbacks
     LogicalDecodeShutdownCB shutdown_cb;
 } OutputPluginCallbacks;
 
-typedef void (*LogicalOutputPluginInit)(struct OutputPluginCallbacks *cb);
+typedef void (*LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb);
 </programlisting>
      The <function>begin_cb</function>, <function>change_cb</function>
      and <function>commit_cb</function> callbacks are required,
@@ -452,11 +452,9 @@ CREATE TABLE another_catalog_table(data text) WITH (user_catalog_table = true);
       a replication slot is created or asked to stream changes, independent
       of the number of changes that are ready to be put out.
 <programlisting>
-typedef void (*LogicalDecodeStartupCB) (
-    struct LogicalDecodingContext *ctx,
-    OutputPluginOptions *options,
-    bool is_init
-);
+typedef void (*LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx,
+                                        OutputPluginOptions *options,
+                                        bool is_init);
 </programlisting>
       The <literal>is_init</literal> parameter will be true when the
       replication slot is being created and false
@@ -491,9 +489,7 @@ typedef struct OutputPluginOptions
       be used to deallocate resources private to the output plugin. The slot
       isn't necessarily being dropped, streaming is just being stopped.
 <programlisting>
-typedef void (*LogicalDecodeShutdownCB) (
-    struct LogicalDecodingContext *ctx
-);
+typedef void (*LogicalDecodeShutdownCB) (struct LogicalDecodingContext *ctx);
 </programlisting>
      </para>
     </sect3>
@@ -506,10 +502,8 @@ typedef void (*LogicalDecodeShutdownCB) (
       start of a committed transaction has been decoded. Aborted transactions
       and their contents never get decoded.
 <programlisting>
-typedef void (*LogicalDecodeBeginCB) (
-    struct LogicalDecodingContext *,
-    ReorderBufferTXN *txn
-);
+typedef void (*LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx,
+                                      ReorderBufferTXN *txn);
 </programlisting>
       The <parameter>txn</parameter> parameter contains meta information about
       the transaction, like the time stamp at which it has been committed and
@@ -527,10 +521,9 @@ typedef void (*LogicalDecodeBeginCB) (
       rows will have been called before this, if there have been any modified
       rows.
 <programlisting>
-typedef void (*LogicalDecodeCommitCB) (
-    struct LogicalDecodingContext *,
-    ReorderBufferTXN *txn
-);
+typedef void (*LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx,
+                                       ReorderBufferTXN *txn,
+                                       XLogRecPtr commit_lsn);
 </programlisting>
      </para>
     </sect3>
@@ -546,12 +539,10 @@ typedef void (*LogicalDecodeCommitCB) (
       several rows at once the callback will be called individually for each
       row.
 <programlisting>
-typedef void (*LogicalDecodeChangeCB) (
-    struct LogicalDecodingContext *ctx,
-    ReorderBufferTXN *txn,
-    Relation relation,
-    ReorderBufferChange *change
-);
+typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx,
+                                       ReorderBufferTXN *txn,
+                                       Relation relation,
+                                       ReorderBufferChange *change);
 </programlisting>
       The <parameter>ctx</parameter> and <parameter>txn</parameter> parameters
       have the same contents as for the <function>begin_cb</function>
@@ -581,10 +572,8 @@ typedef void (*LogicalDecodeChangeCB) (
        from <parameter>origin_id</parameter> is of interest to the
        output plugin.
 <programlisting>
-typedef bool (*LogicalDecodeFilterByOriginCB) (
-    struct LogicalDecodingContext *ctx,
-    RepNodeId origin_id
-);
+typedef bool (*LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx,
+                                               RepOriginId origin_id);
 </programlisting>
       The <parameter>ctx</parameter> parameter has the same contents
       as for the other callbacks. No information but the origin is
index 17c3de235e60e2cef47caeff985bad390e8ac3e7..0039974c1e6ceddff772b7ea6bd5a9974cf49006 100644 (file)
@@ -41,51 +41,42 @@ typedef void (*LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb);
  * "is_init" will be set to "true" if the decoding slot just got defined. When
  * the same slot is used from there one, it will be "false".
  */
-typedef void (*LogicalDecodeStartupCB) (
-                                                                                 struct LogicalDecodingContext *ctx,
+typedef void (*LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx,
                                                                                                OutputPluginOptions *options,
-                                                                                                       bool is_init
-);
+                                                                                                       bool is_init);
 
 /*
  * Callback called for every (explicit or implicit) BEGIN of a successful
  * transaction.
  */
-typedef void (*LogicalDecodeBeginCB) (
-                                                                                        struct LogicalDecodingContext *,
+typedef void (*LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx,
                                                                                                  ReorderBufferTXN *txn);
 
 /*
  * Callback for every individual change in a successful transaction.
  */
-typedef void (*LogicalDecodeChangeCB) (
-                                                                                        struct LogicalDecodingContext *,
+typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx,
                                                                                                   ReorderBufferTXN *txn,
                                                                                                   Relation relation,
-                                                                                                  ReorderBufferChange *change
-);
+                                                                                               ReorderBufferChange *change);
 
 /*
  * Called for every (explicit or implicit) COMMIT of a successful transaction.
  */
-typedef void (*LogicalDecodeCommitCB) (
-                                                                                        struct LogicalDecodingContext *,
+typedef void (*LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx,
                                                                                                   ReorderBufferTXN *txn,
                                                                                                   XLogRecPtr commit_lsn);
 
 /*
  * Filter changes by origin.
  */
-typedef bool (*LogicalDecodeFilterByOriginCB) (
-                                                                                        struct LogicalDecodingContext *,
+typedef bool (*LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx,
                                                                                                          RepOriginId origin_id);
 
 /*
  * Called to shutdown an output plugin.
  */
-typedef void (*LogicalDecodeShutdownCB) (
-                                                                                         struct LogicalDecodingContext *
-);
+typedef void (*LogicalDecodeShutdownCB) (struct LogicalDecodingContext *ctx);
 
 /*
  * Output plugin callbacks
@@ -100,7 +91,8 @@ typedef struct OutputPluginCallbacks
        LogicalDecodeShutdownCB shutdown_cb;
 } OutputPluginCallbacks;
 
-void           OutputPluginPrepareWrite(struct LogicalDecodingContext *ctx, bool last_write);
-void           OutputPluginWrite(struct LogicalDecodingContext *ctx, bool last_write);
+/* Functions in replication/logical/logical.c */
+extern void OutputPluginPrepareWrite(struct LogicalDecodingContext *ctx, bool last_write);
+extern void OutputPluginWrite(struct LogicalDecodingContext *ctx, bool last_write);
 
 #endif   /* OUTPUT_PLUGIN_H */