2017-01-19 18:00:00 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* logicalrelation.h
|
|
|
|
* Relation definitions for logical replication relation mapping.
|
|
|
|
*
|
2017-01-25 18:32:05 +01:00
|
|
|
* Portions Copyright (c) 2016-2017, PostgreSQL Global Development Group
|
2017-01-19 18:00:00 +01:00
|
|
|
*
|
|
|
|
* src/include/replication/logicalrelation.h
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef LOGICALRELATION_H
|
|
|
|
#define LOGICALRELATION_H
|
|
|
|
|
|
|
|
#include "replication/logicalproto.h"
|
|
|
|
|
|
|
|
typedef struct LogicalRepRelMapEntry
|
|
|
|
{
|
2017-05-17 22:31:56 +02:00
|
|
|
LogicalRepRelation remoterel; /* key is remoterel.remoteid */
|
2017-01-19 18:00:00 +01:00
|
|
|
|
|
|
|
/* Mapping to local relation, filled as needed. */
|
2017-05-17 22:31:56 +02:00
|
|
|
Oid localreloid; /* local relation id */
|
|
|
|
Relation localrel; /* relcache entry */
|
|
|
|
AttrNumber *attrmap; /* map of local attributes to remote ones */
|
|
|
|
bool updatable; /* Can apply updates/deletes? */
|
2017-01-19 18:00:00 +01:00
|
|
|
|
|
|
|
/* Sync state. */
|
2017-05-17 22:31:56 +02:00
|
|
|
char state;
|
|
|
|
XLogRecPtr statelsn;
|
2017-01-19 18:00:00 +01:00
|
|
|
} LogicalRepRelMapEntry;
|
|
|
|
|
|
|
|
extern void logicalrep_relmap_update(LogicalRepRelation *remoterel);
|
|
|
|
|
|
|
|
extern LogicalRepRelMapEntry *logicalrep_rel_open(LogicalRepRelId remoteid,
|
2017-05-17 22:31:56 +02:00
|
|
|
LOCKMODE lockmode);
|
2017-01-19 18:00:00 +01:00
|
|
|
extern void logicalrep_rel_close(LogicalRepRelMapEntry *rel,
|
2017-05-17 22:31:56 +02:00
|
|
|
LOCKMODE lockmode);
|
2017-01-19 18:00:00 +01:00
|
|
|
|
|
|
|
extern void logicalrep_typmap_update(LogicalRepTyp *remotetyp);
|
2017-05-17 22:31:56 +02:00
|
|
|
extern Oid logicalrep_typmap_getid(Oid remoteid);
|
2017-01-19 18:00:00 +01:00
|
|
|
|
|
|
|
#endif /* LOGICALRELATION_H */
|