PostgreSQL Source Code  git master
logical.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  * logical.h
3  * PostgreSQL logical decoding coordination
4  *
5  * Copyright (c) 2012-2017, PostgreSQL Global Development Group
6  *
7  *-------------------------------------------------------------------------
8  */
9 #ifndef LOGICAL_H
10 #define LOGICAL_H
11 
12 #include "replication/slot.h"
13 
14 #include "access/xlog.h"
15 #include "access/xlogreader.h"
17 
19 
21  struct LogicalDecodingContext *lr,
22  XLogRecPtr Ptr,
23  TransactionId xid,
24  bool last_write
25 );
26 
28 
30  struct LogicalDecodingContext *lr,
31  XLogRecPtr Ptr,
32  TransactionId xid
33 );
34 
35 typedef struct LogicalDecodingContext
36 {
37  /* memory context this is all allocated in */
39 
40  /* The associated replication slot */
42 
43  /* infrastructure pieces for decoding */
47 
50 
51  /*
52  * User specified options
53  */
55 
56  /*
57  * User-Provided callback for writing/streaming out data.
58  */
62 
63  /*
64  * Output buffer.
65  */
67 
68  /*
69  * Private data pointer of the output plugin.
70  */
72 
73  /*
74  * Private data pointer for the data writer.
75  */
77 
78  /*
79  * State for writing output.
80  */
86 
87 
88 extern void CheckLogicalDecodingRequirements(void);
89 
92  bool need_full_snapshot,
93  XLogPageReadCB read_page,
98  XLogRecPtr start_lsn,
100  XLogPageReadCB read_page,
107 
109 extern void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn,
110  XLogRecPtr restart_lsn);
112 
114 
115 #endif
TransactionId write_xid
Definition: logical.h:84
static const char * plugin
struct ReorderBuffer * reorder
Definition: logical.h:45
uint32 TransactionId
Definition: c.h:445
OutputPluginOptions options
Definition: logical.h:49
bool DecodingContextReady(LogicalDecodingContext *ctx)
Definition: logical.c:423
OutputPluginCallbacks callbacks
Definition: logical.h:48
uint16 RepOriginId
Definition: xlogdefs.h:51
void * output_plugin_private
Definition: logical.h:71
void LogicalIncreaseXminForSlot(XLogRecPtr lsn, TransactionId xmin)
Definition: logical.c:788
MemoryContext context
Definition: logical.h:38
List * output_plugin_options
Definition: logical.h:54
LogicalDecodingContext * CreateInitDecodingContext(char *plugin, List *output_plugin_options, bool need_full_snapshot, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, LogicalOutputPluginWriterUpdateProgress update_progress)
Definition: logical.c:216
LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite
Definition: logical.h:27
void(* LogicalOutputPluginWriterUpdateProgress)(struct LogicalDecodingContext *lr, XLogRecPtr Ptr, TransactionId xid)
Definition: logical.h:29
XLogRecPtr write_location
Definition: logical.h:83
void DecodingContextFindStartpoint(LogicalDecodingContext *ctx)
Definition: logical.c:432
LogicalOutputPluginWriterPrepareWrite prepare_write
Definition: logical.h:59
bool filter_by_origin_cb_wrapper(LogicalDecodingContext *ctx, RepOriginId origin_id)
Definition: logical.c:718
LogicalOutputPluginWriterUpdateProgress update_progress
Definition: logical.h:61
struct LogicalDecodingContext LogicalDecodingContext
void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart_lsn)
Definition: logical.c:845
struct SnapBuild * snapshot_builder
Definition: logical.h:46
uint64 XLogRecPtr
Definition: xlogdefs.h:21
LogicalDecodingContext * CreateDecodingContext(XLogRecPtr start_lsn, List *output_plugin_options, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, LogicalOutputPluginWriterUpdateProgress update_progress)
Definition: logical.c:343
int(* XLogPageReadCB)(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *readBuf, TimeLineID *pageTLI)
Definition: xlogreader.h:33
void(* LogicalOutputPluginWriterWrite)(struct LogicalDecodingContext *lr, XLogRecPtr Ptr, TransactionId xid, bool last_write)
Definition: logical.h:20
void LogicalConfirmReceivedLocation(XLogRecPtr lsn)
Definition: logical.c:914
XLogReaderState * reader
Definition: logical.h:44
TransactionId xmin
Definition: snapbuild.c:162
ReplicationSlot * slot
Definition: logical.h:41
LogicalOutputPluginWriterWrite write
Definition: logical.h:60
StringInfo out
Definition: logical.h:66
void FreeDecodingContext(LogicalDecodingContext *ctx)
Definition: logical.c:475
Definition: pg_list.h:45
void * output_writer_private
Definition: logical.h:76
void CheckLogicalDecodingRequirements(void)
Definition: logical.c:76