-
Notifications
You must be signed in to change notification settings - Fork 15
/
spock_repset.h
96 lines (78 loc) · 3.29 KB
/
spock_repset.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*-------------------------------------------------------------------------
*
* spock_repset.h
* spock replication set manipulation functions
*
* Copyright (c) 2022-2023, pgEdge, Inc.
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, The Regents of the University of California
*
*-------------------------------------------------------------------------
*/
#ifndef SPOCK_REPSET_H
#define SPOCK_REPSET_H
#include "replication/reorderbuffer.h"
typedef struct SpockRepSet
{
Oid id;
Oid nodeid;
char *name;
bool replicate_insert;
bool replicate_update;
bool replicate_delete;
bool replicate_truncate;
} SpockRepSet;
#define DEFAULT_REPSET_NAME "default"
#define DEFAULT_INSONLY_REPSET_NAME "default_insert_only"
#define DDL_SQL_REPSET_NAME "ddl_sql"
/* This is only valid within one output plugin instance/walsender. */
typedef struct SpockTableRepInfo
{
Oid reloid; /* key */
bool isvalid; /* is this entry valid? */
bool replicate_insert; /* should insert be replicated? */
bool replicate_update; /* should update be replicated? */
bool replicate_delete; /* should delete be replicated? */
Bitmapset *att_list; /* column filter
NULL if everything is replicated
otherwise each replicated column
is a member */
List *row_filter; /* compiled row_filter nodes */
} SpockTableRepInfo;
/* forward declaration */
struct RepSetTableTuple;
typedef struct RepSetTableTuple RepSetTableTuple;
extern SpockRepSet *get_replication_set(Oid setid);
extern SpockRepSet *get_replication_set_by_name(Oid nodeid,
const char *setname,
bool missing_ok);
extern List *get_node_replication_sets(Oid nodeid);
extern List *get_replication_sets(Oid nodeid, List *replication_set_names,
bool missing_ok);
extern SpockTableRepInfo *get_table_replication_info(Oid nodeid,
Relation table, List *subs_replication_sets);
extern RepSetTableTuple *get_table_replication_row(Oid repsetid, Oid reloid,
List **att_list, Node **row_filter);
extern void create_replication_set(SpockRepSet *repset);
extern void alter_replication_set(SpockRepSet *repset);
extern void drop_replication_set(Oid setid);
extern void drop_node_replication_sets(Oid nodeid);
extern void replication_set_add_table(Oid setid, Oid reloid,
List *att_list, Node *row_filter);
extern void replication_set_add_seq(Oid setid, Oid seqoid);
extern List *replication_set_get_tables(Oid setid);
extern List *replication_set_get_seqs(Oid setid);
extern PGDLLEXPORT void replication_set_remove_table(Oid setid, Oid reloid,
bool from_drop);
extern PGDLLEXPORT void replication_set_remove_seq(Oid setid, Oid reloid,
bool from_drop);
extern List *get_table_replication_sets(Oid nodeid, Oid reloid);
extern List *get_seq_replication_sets(Oid nodeid, Oid seqoid);
extern SpockRepSet *replication_set_from_tuple(HeapTuple tuple);
extern Oid get_replication_set_rel_oid(void);
extern Oid get_replication_set_table_rel_oid(void);
extern Oid get_replication_set_seq_rel_oid(void);
extern char *stringlist_to_identifierstr(List *strings);
extern char *repsetslist_to_identifierstr(List *repsets);
extern int get_att_num_by_name(TupleDesc desc, const char *attname);
#endif /* SPOCK_REPSET_H */