| |
| |
| |
| |
| |
| |
| |
| |
| #ifndef LOGICAL_H |
| #define LOGICAL_H |
|
|
| #include "access/xlog.h" |
| #include "access/xlogreader.h" |
| #include "replication/output_plugin.h" |
| #include "replication/slot.h" |
|
|
| struct LogicalDecodingContext; |
|
|
| typedef void (*LogicalOutputPluginWriterWrite) (struct LogicalDecodingContext *lr, |
| XLogRecPtr Ptr, |
| TransactionId xid, |
| bool last_write |
| ); |
|
|
| typedef LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite; |
|
|
| typedef void (*LogicalOutputPluginWriterUpdateProgress) (struct LogicalDecodingContext *lr, |
| XLogRecPtr Ptr, |
| TransactionId xid, |
| bool skipped_xact |
| ); |
|
|
| typedef struct LogicalDecodingContext |
| { |
| |
| MemoryContext context; |
|
|
| |
| ReplicationSlot *slot; |
|
|
| |
| XLogReaderState *reader; |
| struct ReorderBuffer *reorder; |
| struct SnapBuild *snapshot_builder; |
|
|
| |
| |
| |
| |
| |
| bool fast_forward; |
|
|
| OutputPluginCallbacks callbacks; |
| OutputPluginOptions options; |
|
|
| |
| |
| |
| List *output_plugin_options; |
|
|
| |
| |
| |
| LogicalOutputPluginWriterPrepareWrite prepare_write; |
| LogicalOutputPluginWriterWrite write; |
| LogicalOutputPluginWriterUpdateProgress update_progress; |
|
|
| |
| |
| |
| StringInfo out; |
|
|
| |
| |
| |
| void *output_plugin_private; |
|
|
| |
| |
| |
| void *output_writer_private; |
|
|
| |
| |
| |
| bool streaming; |
|
|
| |
| |
| |
| bool twophase; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| bool twophase_opt_given; |
|
|
| |
| |
| |
| bool accept_writes; |
| bool prepared_write; |
| XLogRecPtr write_location; |
| TransactionId write_xid; |
| |
| bool end_xact; |
|
|
| |
| bool processing_required; |
| } LogicalDecodingContext; |
|
|
|
|
| extern void CheckLogicalDecodingRequirements(void); |
|
|
| extern LogicalDecodingContext *CreateInitDecodingContext(const char *plugin, |
| List *output_plugin_options, |
| bool need_full_snapshot, |
| XLogRecPtr restart_lsn, |
| XLogReaderRoutine *xl_routine, |
| LogicalOutputPluginWriterPrepareWrite prepare_write, |
| LogicalOutputPluginWriterWrite do_write, |
| LogicalOutputPluginWriterUpdateProgress update_progress); |
| extern LogicalDecodingContext *CreateDecodingContext(XLogRecPtr start_lsn, |
| List *output_plugin_options, |
| bool fast_forward, |
| XLogReaderRoutine *xl_routine, |
| LogicalOutputPluginWriterPrepareWrite prepare_write, |
| LogicalOutputPluginWriterWrite do_write, |
| LogicalOutputPluginWriterUpdateProgress update_progress); |
| extern void DecodingContextFindStartpoint(LogicalDecodingContext *ctx); |
| extern bool DecodingContextReady(LogicalDecodingContext *ctx); |
| extern void FreeDecodingContext(LogicalDecodingContext *ctx); |
|
|
| extern void LogicalIncreaseXminForSlot(XLogRecPtr current_lsn, |
| TransactionId xmin); |
| extern void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, |
| XLogRecPtr restart_lsn); |
| extern void LogicalConfirmReceivedLocation(XLogRecPtr lsn); |
|
|
| extern bool filter_prepare_cb_wrapper(LogicalDecodingContext *ctx, |
| TransactionId xid, const char *gid); |
| extern bool filter_by_origin_cb_wrapper(LogicalDecodingContext *ctx, RepOriginId origin_id); |
| extern void ResetLogicalStreamingState(void); |
| extern void UpdateDecodingStats(LogicalDecodingContext *ctx); |
|
|
| extern bool LogicalReplicationSlotHasPendingWal(XLogRecPtr end_of_wal); |
| extern XLogRecPtr LogicalSlotAdvanceAndCheckSnapState(XLogRecPtr moveto, |
| bool *found_consistent_snapshot); |
|
|
| #endif |
|
|