PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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(* 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 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)
 

Typedef Documentation

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

Definition at line 52 of file output_plugin.h.

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

Definition at line 58 of file output_plugin.h.

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

Definition at line 66 of file output_plugin.h.

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

Definition at line 84 of file output_plugin.h.

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 73 of file output_plugin.h.

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

Definition at line 90 of file output_plugin.h.

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

Definition at line 44 of file output_plugin.h.

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

Definition at line 35 of file output_plugin.h.

Enumeration Type Documentation

Enumerator
OUTPUT_PLUGIN_BINARY_OUTPUT 
OUTPUT_PLUGIN_TEXTUAL_OUTPUT 

Definition at line 17 of file output_plugin.h.

Function Documentation

void OutputPluginPrepareWrite ( struct LogicalDecodingContext ctx,
bool  last_write 
)

Definition at line 472 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_output_begin(), pgoutput_begin_txn(), pgoutput_change(), and pgoutput_commit_txn().

473 {
474  if (!ctx->accept_writes)
475  elog(ERROR, "writes are only accepted in commit, begin and change callbacks");
476 
477  ctx->prepare_write(ctx, ctx->write_location, ctx->write_xid, last_write);
478  ctx->prepared_write = true;
479 }
TransactionId write_xid
Definition: logical.h:75
XLogRecPtr write_location
Definition: logical.h:74
#define ERROR
Definition: elog.h:43
LogicalOutputPluginWriterPrepareWrite prepare_write
Definition: logical.h:51
#define elog
Definition: elog.h:219
void OutputPluginWrite ( struct LogicalDecodingContext ctx,
bool  last_write 
)

Definition at line 485 of file logical.c.

References elog, ERROR, LogicalDecodingContext::prepared_write, LogicalDecodingContext::write, LogicalDecodingContext::write_location, and LogicalDecodingContext::write_xid.

Referenced by pg_decode_change(), pg_decode_commit_txn(), pg_decode_message(), pg_output_begin(), pgoutput_begin_txn(), pgoutput_change(), and pgoutput_commit_txn().

486 {
487  if (!ctx->prepared_write)
488  elog(ERROR, "OutputPluginPrepareWrite needs to be called before OutputPluginWrite");
489 
490  ctx->write(ctx, ctx->write_location, ctx->write_xid, last_write);
491  ctx->prepared_write = false;
492 }
TransactionId write_xid
Definition: logical.h:75
XLogRecPtr write_location
Definition: logical.h:74
#define ERROR
Definition: elog.h:43
LogicalOutputPluginWriterWrite write
Definition: logical.h:52
#define elog
Definition: elog.h:219