mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Formatting and docs corrections for logical decoding output plugins.
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.
This commit is contained in:
parent
adb67d67f0
commit
93e6e40574
@ -380,7 +380,7 @@ typedef struct OutputPluginCallbacks
|
|||||||
LogicalDecodeShutdownCB shutdown_cb;
|
LogicalDecodeShutdownCB shutdown_cb;
|
||||||
} OutputPluginCallbacks;
|
} OutputPluginCallbacks;
|
||||||
|
|
||||||
typedef void (*LogicalOutputPluginInit)(struct OutputPluginCallbacks *cb);
|
typedef void (*LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
The <function>begin_cb</function>, <function>change_cb</function>
|
The <function>begin_cb</function>, <function>change_cb</function>
|
||||||
and <function>commit_cb</function> callbacks are required,
|
and <function>commit_cb</function> callbacks are required,
|
||||||
@ -465,11 +465,9 @@ CREATE TABLE another_catalog_table(data text) WITH (user_catalog_table = true);
|
|||||||
a replication slot is created or asked to stream changes, independent
|
a replication slot is created or asked to stream changes, independent
|
||||||
of the number of changes that are ready to be put out.
|
of the number of changes that are ready to be put out.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
typedef void (*LogicalDecodeStartupCB) (
|
typedef void (*LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *ctx,
|
|
||||||
OutputPluginOptions *options,
|
OutputPluginOptions *options,
|
||||||
bool is_init
|
bool is_init);
|
||||||
);
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
The <literal>is_init</literal> parameter will be true when the
|
The <literal>is_init</literal> parameter will be true when the
|
||||||
replication slot is being created and false
|
replication slot is being created and false
|
||||||
@ -504,9 +502,7 @@ typedef struct OutputPluginOptions
|
|||||||
be used to deallocate resources private to the output plugin. The slot
|
be used to deallocate resources private to the output plugin. The slot
|
||||||
isn't necessarily being dropped, streaming is just being stopped.
|
isn't necessarily being dropped, streaming is just being stopped.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
typedef void (*LogicalDecodeShutdownCB) (
|
typedef void (*LogicalDecodeShutdownCB) (struct LogicalDecodingContext *ctx);
|
||||||
struct LogicalDecodingContext *ctx
|
|
||||||
);
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
</sect3>
|
</sect3>
|
||||||
@ -519,10 +515,8 @@ typedef void (*LogicalDecodeShutdownCB) (
|
|||||||
start of a committed transaction has been decoded. Aborted transactions
|
start of a committed transaction has been decoded. Aborted transactions
|
||||||
and their contents never get decoded.
|
and their contents never get decoded.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
typedef void (*LogicalDecodeBeginCB) (
|
typedef void (*LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *,
|
ReorderBufferTXN *txn);
|
||||||
ReorderBufferTXN *txn
|
|
||||||
);
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
The <parameter>txn</parameter> parameter contains meta information about
|
The <parameter>txn</parameter> parameter contains meta information about
|
||||||
the transaction, like the time stamp at which it has been committed and
|
the transaction, like the time stamp at which it has been committed and
|
||||||
@ -540,10 +534,9 @@ typedef void (*LogicalDecodeBeginCB) (
|
|||||||
rows will have been called before this, if there have been any modified
|
rows will have been called before this, if there have been any modified
|
||||||
rows.
|
rows.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
typedef void (*LogicalDecodeCommitCB) (
|
typedef void (*LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *,
|
ReorderBufferTXN *txn,
|
||||||
ReorderBufferTXN *txn
|
XLogRecPtr commit_lsn);
|
||||||
);
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
</sect3>
|
</sect3>
|
||||||
@ -559,12 +552,10 @@ typedef void (*LogicalDecodeCommitCB) (
|
|||||||
several rows at once the callback will be called individually for each
|
several rows at once the callback will be called individually for each
|
||||||
row.
|
row.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
typedef void (*LogicalDecodeChangeCB) (
|
typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *ctx,
|
|
||||||
ReorderBufferTXN *txn,
|
ReorderBufferTXN *txn,
|
||||||
Relation relation,
|
Relation relation,
|
||||||
ReorderBufferChange *change
|
ReorderBufferChange *change);
|
||||||
);
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
The <parameter>ctx</parameter> and <parameter>txn</parameter> parameters
|
The <parameter>ctx</parameter> and <parameter>txn</parameter> parameters
|
||||||
have the same contents as for the <function>begin_cb</function>
|
have the same contents as for the <function>begin_cb</function>
|
||||||
@ -594,10 +585,8 @@ typedef void (*LogicalDecodeChangeCB) (
|
|||||||
from <parameter>origin_id</parameter> is of interest to the
|
from <parameter>origin_id</parameter> is of interest to the
|
||||||
output plugin.
|
output plugin.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
typedef bool (*LogicalDecodeFilterByOriginCB) (
|
typedef bool (*LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *ctx,
|
RepOriginId origin_id);
|
||||||
RepNodeId origin_id
|
|
||||||
);
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
The <parameter>ctx</parameter> parameter has the same contents
|
The <parameter>ctx</parameter> parameter has the same contents
|
||||||
as for the other callbacks. No information but the origin is
|
as for the other callbacks. No information but the origin is
|
||||||
@ -623,15 +612,13 @@ typedef bool (*LogicalDecodeFilterByOriginCB) (
|
|||||||
The optional <function>message_cb</function> callback is called whenever
|
The optional <function>message_cb</function> callback is called whenever
|
||||||
a logical decoding message has been decoded.
|
a logical decoding message has been decoded.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
typedef void (*LogicalDecodeMessageCB) (
|
typedef void (*LogicalDecodeMessageCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *,
|
|
||||||
ReorderBufferTXN *txn,
|
ReorderBufferTXN *txn,
|
||||||
XLogRecPtr message_lsn,
|
XLogRecPtr message_lsn,
|
||||||
bool transactional,
|
bool transactional,
|
||||||
const char *prefix,
|
const char *prefix,
|
||||||
Size message_size,
|
Size message_size,
|
||||||
const char *message
|
const char *message);
|
||||||
);
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
The <parameter>txn</parameter> parameter contains meta information about
|
The <parameter>txn</parameter> parameter contains meta information about
|
||||||
the transaction, like the time stamp at which it has been committed and
|
the transaction, like the time stamp at which it has been committed and
|
||||||
|
@ -41,43 +41,36 @@ typedef void (*LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb);
|
|||||||
* "is_init" will be set to "true" if the decoding slot just got defined. When
|
* "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".
|
* the same slot is used from there one, it will be "false".
|
||||||
*/
|
*/
|
||||||
typedef void (*LogicalDecodeStartupCB) (
|
typedef void (*LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *ctx,
|
|
||||||
OutputPluginOptions *options,
|
OutputPluginOptions *options,
|
||||||
bool is_init
|
bool is_init);
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback called for every (explicit or implicit) BEGIN of a successful
|
* Callback called for every (explicit or implicit) BEGIN of a successful
|
||||||
* transaction.
|
* transaction.
|
||||||
*/
|
*/
|
||||||
typedef void (*LogicalDecodeBeginCB) (
|
typedef void (*LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *,
|
|
||||||
ReorderBufferTXN *txn);
|
ReorderBufferTXN *txn);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback for every individual change in a successful transaction.
|
* Callback for every individual change in a successful transaction.
|
||||||
*/
|
*/
|
||||||
typedef void (*LogicalDecodeChangeCB) (
|
typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *,
|
|
||||||
ReorderBufferTXN *txn,
|
ReorderBufferTXN *txn,
|
||||||
Relation relation,
|
Relation relation,
|
||||||
ReorderBufferChange *change
|
ReorderBufferChange *change);
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called for every (explicit or implicit) COMMIT of a successful transaction.
|
* Called for every (explicit or implicit) COMMIT of a successful transaction.
|
||||||
*/
|
*/
|
||||||
typedef void (*LogicalDecodeCommitCB) (
|
typedef void (*LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *,
|
|
||||||
ReorderBufferTXN *txn,
|
ReorderBufferTXN *txn,
|
||||||
XLogRecPtr commit_lsn);
|
XLogRecPtr commit_lsn);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called for the generic logical decoding messages.
|
* Called for the generic logical decoding messages.
|
||||||
*/
|
*/
|
||||||
typedef void (*LogicalDecodeMessageCB) (
|
typedef void (*LogicalDecodeMessageCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *,
|
|
||||||
ReorderBufferTXN *txn,
|
ReorderBufferTXN *txn,
|
||||||
XLogRecPtr message_lsn,
|
XLogRecPtr message_lsn,
|
||||||
bool transactional,
|
bool transactional,
|
||||||
@ -88,16 +81,13 @@ typedef void (*LogicalDecodeMessageCB) (
|
|||||||
/*
|
/*
|
||||||
* Filter changes by origin.
|
* Filter changes by origin.
|
||||||
*/
|
*/
|
||||||
typedef bool (*LogicalDecodeFilterByOriginCB) (
|
typedef bool (*LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx,
|
||||||
struct LogicalDecodingContext *,
|
|
||||||
RepOriginId origin_id);
|
RepOriginId origin_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called to shutdown an output plugin.
|
* Called to shutdown an output plugin.
|
||||||
*/
|
*/
|
||||||
typedef void (*LogicalDecodeShutdownCB) (
|
typedef void (*LogicalDecodeShutdownCB) (struct LogicalDecodingContext *ctx);
|
||||||
struct LogicalDecodingContext *
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output plugin callbacks
|
* Output plugin callbacks
|
||||||
@ -113,7 +103,8 @@ typedef struct OutputPluginCallbacks
|
|||||||
LogicalDecodeShutdownCB shutdown_cb;
|
LogicalDecodeShutdownCB shutdown_cb;
|
||||||
} OutputPluginCallbacks;
|
} OutputPluginCallbacks;
|
||||||
|
|
||||||
void OutputPluginPrepareWrite(struct LogicalDecodingContext *ctx, bool last_write);
|
/* Functions in replication/logical/logical.c */
|
||||||
void OutputPluginWrite(struct LogicalDecodingContext *ctx, bool last_write);
|
extern void OutputPluginPrepareWrite(struct LogicalDecodingContext *ctx, bool last_write);
|
||||||
|
extern void OutputPluginWrite(struct LogicalDecodingContext *ctx, bool last_write);
|
||||||
|
|
||||||
#endif /* OUTPUT_PLUGIN_H */
|
#endif /* OUTPUT_PLUGIN_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user