summaryrefslogtreecommitdiff
path: root/src/include/replication
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-01-20 09:16:24 +0000
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-01-20 09:16:24 +0000
commit32bc08b1d45d898aabdeeed09bcf1c2a407bbbed (patch)
treeb471343c464562c72ce814d9e2ffaa3d99ead31c /src/include/replication
parenteb210ce85a6326412f2a35eb416d92801cfe997d (diff)
downloadpostgresql-32bc08b1d45d898aabdeeed09bcf1c2a407bbbed.tar.gz
Rethink the way walreceiver is linked into the backend. Instead than shoving
walreceiver as whole into a dynamically loaded module, split the libpq-specific parts of it into dynamically loaded module and keep the rest in the main backend binary. Although Tom fixed the Windows compilation problems with the old walreceiver module already, this is a cleaner division of labour and makes the code more readable. There's also the prospect of adding new transport methods as pluggable modules in the future, which this patch makes easier, though for now the API between libpqwalreceiver and walreceiver process should be considered private. The libpq-specific module is now in src/backend/replication/libpqwalreceiver, and the part linked with postgres binary is in src/backend/replication/walreceiver.c.
Diffstat (limited to 'src/include/replication')
-rw-r--r--src/include/replication/walreceiver.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h
index f848a9e509..57de368d41 100644
--- a/src/include/replication/walreceiver.h
+++ b/src/include/replication/walreceiver.h
@@ -5,13 +5,14 @@
*
* Portions Copyright (c) 2010-2010, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/replication/walreceiver.h,v 1.2 2010/01/16 00:04:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/replication/walreceiver.h,v 1.3 2010/01/20 09:16:24 heikki Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef _WALRECEIVER_H
#define _WALRECEIVER_H
+#include "access/xlogdefs.h"
#include "storage/spin.h"
/*
@@ -60,6 +61,17 @@ typedef struct
extern PGDLLIMPORT WalRcvData *WalRcv;
+/* libpqwalreceiver hooks */
+typedef bool (*walrcv_connect_type) (char *conninfo, XLogRecPtr startpoint);
+extern PGDLLIMPORT walrcv_connect_type walrcv_connect;
+
+typedef bool (*walrcv_receive_type) (int timeout, XLogRecPtr *recptr, char **buffer, int *len);
+extern PGDLLIMPORT walrcv_receive_type walrcv_receive;
+
+typedef void (*walrcv_disconnect_type) (void);
+extern PGDLLIMPORT walrcv_disconnect_type walrcv_disconnect;
+
+extern void WalReceiverMain(void);
extern Size WalRcvShmemSize(void);
extern void WalRcvShmemInit(void);
extern bool WalRcvInProgress(void);