-
Notifications
You must be signed in to change notification settings - Fork 15
/
spock_node.h
85 lines (73 loc) · 2.27 KB
/
spock_node.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
/*-------------------------------------------------------------------------
*
* spock_node.h
* spock node and connection catalog 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_NODE_H
#define SPOCK_NODE_H
#include "datatype/timestamp.h"
#include "utils/jsonb.h"
typedef struct SpockNode
{
Oid id;
char *name;
char *location;
char *country;
Jsonb *info;
} SpockNode;
typedef struct SpockInterface
{
Oid id;
const char *name;
Oid nodeid;
const char *dsn;
} SpockInterface;
typedef struct SpockLocalNode
{
SpockNode *node;
SpockInterface *node_if;
} SpockLocalNode;
typedef struct SpockSubscription
{
Oid id;
char *name;
SpockNode *origin;
SpockNode *target;
SpockInterface *origin_if;
SpockInterface *target_if;
bool enabled;
Interval *apply_delay;
char *slot_name;
List *replication_sets;
List *forward_origins;
bool force_text_transfer;
} SpockSubscription;
extern void create_node(SpockNode *node);
extern void drop_node(Oid nodeid);
extern SpockNode *get_node(Oid nodeid);
extern SpockNode *get_node_by_name(const char *name, bool missing_ok);
extern void create_node_interface(SpockInterface *node);
extern void drop_node_interface(Oid ifid);
extern void drop_node_interfaces(Oid nodeid);
extern SpockInterface *get_node_interface(Oid ifid);
extern SpockInterface *get_node_interface_by_name(Oid nodeid,
const char *name,
bool missing_ok);
extern void create_local_node(Oid nodeid, Oid ifid);
extern void drop_local_node(void);
extern SpockLocalNode *get_local_node(bool for_update, bool missing_ok);
extern bool is_local_node(void);
extern void create_subscription(SpockSubscription *sub);
extern void alter_subscription(SpockSubscription *sub);
extern void drop_subscription(Oid subid);
extern SpockSubscription *get_subscription(Oid subid);
extern SpockSubscription *get_subscription_by_name(const char *name,
bool missing_ok);
extern List *get_node_subscriptions(Oid nodeid, bool origin);
#endif /* SPOCK_NODE_H */