PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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 
29 typedef struct LogicalDecodingContext
30 {
31  /* memory context this is all allocated in */
33 
34  /* infrastructure pieces */
39 
42 
43  /*
44  * User specified options
45  */
47 
48  /*
49  * User-Provided callback for writing/streaming out data.
50  */
53 
54  /*
55  * Output buffer.
56  */
58 
59  /*
60  * Private data pointer of the output plugin.
61  */
63 
64  /*
65  * Private data pointer for the data writer.
66  */
68 
69  /*
70  * State for writing output.
71  */
77 
78 extern void CheckLogicalDecodingRequirements(void);
79 
81  List *output_plugin_options,
82  XLogPageReadCB read_page,
86  XLogRecPtr start_lsn,
87  List *output_plugin_options,
88  XLogPageReadCB read_page,
94 
97  XLogRecPtr restart_lsn);
99 
101 
102 #endif
LogicalDecodingContext * CreateInitDecodingContext(char *plugin, List *output_plugin_options, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write)
Definition: logical.c:211
TransactionId write_xid
Definition: logical.h:75
static const char * plugin
struct ReorderBuffer * reorder
Definition: logical.h:37
uint32 TransactionId
Definition: c.h:394
OutputPluginOptions options
Definition: logical.h:41
bool DecodingContextReady(LogicalDecodingContext *ctx)
Definition: logical.c:405
OutputPluginCallbacks callbacks
Definition: logical.h:40
uint16 RepOriginId
Definition: xlogdefs.h:51
void * output_plugin_private
Definition: logical.h:62
void LogicalIncreaseXminForSlot(XLogRecPtr lsn, TransactionId xmin)
Definition: logical.c:758
MemoryContext context
Definition: logical.h:32
List * output_plugin_options
Definition: logical.h:46
LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite
Definition: logical.h:27
XLogRecPtr write_location
Definition: logical.h:74
void DecodingContextFindStartpoint(LogicalDecodingContext *ctx)
Definition: logical.c:414
LogicalDecodingContext * CreateDecodingContext(XLogRecPtr start_lsn, List *output_plugin_options, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write)
Definition: logical.c:327
LogicalOutputPluginWriterPrepareWrite prepare_write
Definition: logical.h:51
bool filter_by_origin_cb_wrapper(LogicalDecodingContext *ctx, RepOriginId origin_id)
Definition: logical.c:688
void(* LogicalOutputPluginWriterWrite)(struct LogicalDecodingContext *lr, XLogRecPtr Ptr, TransactionId xid, bool last_write)
Definition: logical.h:20
struct LogicalDecodingContext LogicalDecodingContext
void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart_lsn)
Definition: logical.c:815
struct SnapBuild * snapshot_builder
Definition: logical.h:38
uint64 XLogRecPtr
Definition: xlogdefs.h:21
int(* XLogPageReadCB)(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *readBuf, TimeLineID *pageTLI)
Definition: xlogreader.h:33
void LogicalConfirmReceivedLocation(XLogRecPtr lsn)
Definition: logical.c:884
XLogReaderState * reader
Definition: logical.h:35
TransactionId xmin
Definition: snapbuild.c:149
ReplicationSlot * slot
Definition: logical.h:36
LogicalOutputPluginWriterWrite write
Definition: logical.h:52
StringInfo out
Definition: logical.h:57
void FreeDecodingContext(LogicalDecodingContext *ctx)
Definition: logical.c:457
Definition: pg_list.h:45
void * output_writer_private
Definition: logical.h:67
void CheckLogicalDecodingRequirements(void)
Definition: logical.c:76