PostgreSQL Source Code  git master
output_plugin.h File Reference
Include dependency graph for output_plugin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  OutputPluginOptions
 
struct  OutputPluginCallbacks
 

Typedefs

typedef enum OutputPluginOutputType OutputPluginOutputType
 
typedef struct OutputPluginOptions OutputPluginOptions
 
typedef void(* LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb)
 
typedef void(* LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx, OutputPluginOptions *options, bool is_init)
 
typedef void(* LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
 
typedef void(* LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change)
 
typedef void(* LogicalDecodeTruncateCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change)
 
typedef void(* LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)
 
typedef void(* LogicalDecodeMessageCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr message_lsn, bool transactional, const char *prefix, Size message_size, const char *message)
 
typedef bool(* LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx, RepOriginId origin_id)
 
typedef void(* LogicalDecodeShutdownCB) (struct LogicalDecodingContext *ctx)
 
typedef void(* LogicalDecodeStreamStartCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
 
typedef void(* LogicalDecodeStreamStopCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
 
typedef void(* LogicalDecodeStreamAbortCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr abort_lsn)
 
typedef void(* LogicalDecodeStreamCommitCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)
 
typedef void(* LogicalDecodeStreamChangeCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change)
 
typedef void(* LogicalDecodeStreamMessageCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr message_lsn, bool transactional, const char *prefix, Size message_size, const char *message)
 
typedef void(* LogicalDecodeStreamTruncateCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change)
 
typedef struct OutputPluginCallbacks OutputPluginCallbacks
 

Enumerations

enum  OutputPluginOutputType { OUTPUT_PLUGIN_BINARY_OUTPUT, OUTPUT_PLUGIN_TEXTUAL_OUTPUT }
 

Functions

void OutputPluginPrepareWrite (struct LogicalDecodingContext *ctx, bool last_write)
 
void OutputPluginWrite (struct LogicalDecodingContext *ctx, bool last_write)
 
void OutputPluginUpdateProgress (struct LogicalDecodingContext *ctx)
 

Typedef Documentation

◆ LogicalDecodeBeginCB

typedef void(* LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn)

Definition at line 53 of file output_plugin.h.

◆ LogicalDecodeChangeCB

typedef void(* LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change)

Definition at line 59 of file output_plugin.h.

◆ LogicalDecodeCommitCB

typedef void(* LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)

Definition at line 76 of file output_plugin.h.

◆ LogicalDecodeFilterByOriginCB

typedef bool(* LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx, RepOriginId origin_id)

Definition at line 94 of file output_plugin.h.

◆ LogicalDecodeMessageCB

typedef void(* LogicalDecodeMessageCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr message_lsn, bool transactional, const char *prefix, Size message_size, const char *message)

Definition at line 83 of file output_plugin.h.

◆ LogicalDecodeShutdownCB

typedef void(* LogicalDecodeShutdownCB) (struct LogicalDecodingContext *ctx)

Definition at line 100 of file output_plugin.h.

◆ LogicalDecodeStartupCB

typedef void(* LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx, OutputPluginOptions *options, bool is_init)

Definition at line 45 of file output_plugin.h.

◆ LogicalDecodeStreamAbortCB

typedef void(* LogicalDecodeStreamAbortCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr abort_lsn)

Definition at line 122 of file output_plugin.h.

◆ LogicalDecodeStreamChangeCB

typedef void(* LogicalDecodeStreamChangeCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change)

Definition at line 137 of file output_plugin.h.

◆ LogicalDecodeStreamCommitCB

typedef void(* LogicalDecodeStreamCommitCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)

Definition at line 130 of file output_plugin.h.

◆ LogicalDecodeStreamMessageCB

typedef void(* LogicalDecodeStreamMessageCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, XLogRecPtr message_lsn, bool transactional, const char *prefix, Size message_size, const char *message)

Definition at line 146 of file output_plugin.h.

◆ LogicalDecodeStreamStartCB

typedef void(* LogicalDecodeStreamStartCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn)

Definition at line 107 of file output_plugin.h.

◆ LogicalDecodeStreamStopCB

typedef void(* LogicalDecodeStreamStopCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn)

Definition at line 115 of file output_plugin.h.

◆ LogicalDecodeStreamTruncateCB

typedef void(* LogicalDecodeStreamTruncateCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change)

Definition at line 157 of file output_plugin.h.

◆ LogicalDecodeTruncateCB

typedef void(* LogicalDecodeTruncateCB) (struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change)

Definition at line 67 of file output_plugin.h.

◆ LogicalOutputPluginInit

typedef void(* LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb)

Definition at line 36 of file output_plugin.h.

◆ OutputPluginCallbacks

◆ OutputPluginOptions

◆ OutputPluginOutputType

Enumeration Type Documentation

◆ OutputPluginOutputType

Enumerator
OUTPUT_PLUGIN_BINARY_OUTPUT 
OUTPUT_PLUGIN_TEXTUAL_OUTPUT 

Definition at line 17 of file output_plugin.h.

Function Documentation

◆ OutputPluginPrepareWrite()

void OutputPluginPrepareWrite ( struct LogicalDecodingContext ctx,
bool  last_write 
)

Definition at line 584 of file logical.c.

References LogicalDecodingContext::accept_writes, elog, ERROR, LogicalDecodingContext::prepare_write, LogicalDecodingContext::prepared_write, LogicalDecodingContext::write_location, and LogicalDecodingContext::write_xid.

Referenced by pg_decode_change(), pg_decode_commit_txn(), pg_decode_message(), pg_decode_stream_abort(), pg_decode_stream_change(), pg_decode_stream_commit(), pg_decode_stream_message(), pg_decode_stream_stop(), pg_decode_stream_truncate(), pg_decode_truncate(), pg_output_begin(), pg_output_stream_start(), pgoutput_begin_txn(), pgoutput_change(), pgoutput_commit_txn(), pgoutput_stream_abort(), pgoutput_stream_commit(), pgoutput_stream_start(), pgoutput_stream_stop(), pgoutput_truncate(), and send_relation_and_attrs().

585 {
586  if (!ctx->accept_writes)
587  elog(ERROR, "writes are only accepted in commit, begin and change callbacks");
588 
589  ctx->prepare_write(ctx, ctx->write_location, ctx->write_xid, last_write);
590  ctx->prepared_write = true;
591 }
TransactionId write_xid
Definition: logical.h:93
XLogRecPtr write_location
Definition: logical.h:92
#define ERROR
Definition: elog.h:43
LogicalOutputPluginWriterPrepareWrite prepare_write
Definition: logical.h:63
#define elog(elevel,...)
Definition: elog.h:214

◆ OutputPluginUpdateProgress()

void OutputPluginUpdateProgress ( struct LogicalDecodingContext ctx)

Definition at line 610 of file logical.c.

References LogicalDecodingContext::update_progress, LogicalDecodingContext::write_location, and LogicalDecodingContext::write_xid.

Referenced by pgoutput_commit_txn(), and pgoutput_stream_commit().

611 {
612  if (!ctx->update_progress)
613  return;
614 
615  ctx->update_progress(ctx, ctx->write_location, ctx->write_xid);
616 }
TransactionId write_xid
Definition: logical.h:93
XLogRecPtr write_location
Definition: logical.h:92
LogicalOutputPluginWriterUpdateProgress update_progress
Definition: logical.h:65

◆ OutputPluginWrite()

void OutputPluginWrite ( struct LogicalDecodingContext ctx,
bool  last_write 
)