1 /*
2  * This file and its contents are licensed under the Timescale License.
3  * Please see the included NOTICE for copyright information and
4  * LICENSE-TIMESCALE for a copy of the license.
5  */
6 #ifndef TIMESCALEDB_TSL_DATA_NODE_H
7 #define TIMESCALEDB_TSL_DATA_NODE_H
8 
9 #include <foreign/foreign.h>
10 
11 #include <hypertable_data_node.h>
12 
13 #include "catalog.h"
14 #include "hypertable.h"
15 #include "remote/dist_txn.h"
16 
17 /* Used to skip ACL checks */
18 #define ACL_NO_CHECK N_ACL_RIGHTS
19 
20 extern ForeignServer *data_node_get_foreign_server(const char *node_name, AclMode mode,
21 												   bool fail_on_aclcheck, bool missing_ok);
22 extern ForeignServer *data_node_get_foreign_server_by_oid(Oid foreign_server_oid, AclMode mode);
23 
24 extern TSConnection *data_node_get_connection(const char *const data_node,
25 											  RemoteTxnPrepStmtOption const ps_opt,
26 											  bool transactional);
27 
28 extern Datum data_node_add(PG_FUNCTION_ARGS);
29 extern Datum data_node_delete(PG_FUNCTION_ARGS);
30 extern Datum data_node_attach(PG_FUNCTION_ARGS);
31 extern Datum data_node_detach(PG_FUNCTION_ARGS);
32 extern Datum data_node_block_new_chunks(PG_FUNCTION_ARGS);
33 extern Datum data_node_allow_new_chunks(PG_FUNCTION_ARGS);
34 extern List *data_node_get_node_name_list_with_aclcheck(AclMode mode, bool fail_on_aclcheck);
35 extern List *data_node_get_filtered_node_name_list(ArrayType *nodearr, AclMode mode,
36 												   bool fail_on_aclcheck);
37 extern List *data_node_get_node_name_list(void);
38 extern List *data_node_array_to_node_name_list_with_aclcheck(ArrayType *nodearr, AclMode mode,
39 															 bool fail_on_aclcheck);
40 extern List *data_node_array_to_node_name_list(ArrayType *nodearr);
41 extern List *data_node_oids_to_node_name_list(List *data_node_oids, AclMode mode);
42 extern void data_node_name_list_check_acl(List *data_node_names, AclMode mode);
43 extern Datum data_node_ping(PG_FUNCTION_ARGS);
44 
45 extern HypertableDataNode *data_node_hypertable_get_by_node_name(const Hypertable *ht,
46 																 const char *node_name,
47 																 bool attach_check);
48 
49 /* This should only be used for testing */
50 extern Datum data_node_add_without_dist_id(PG_FUNCTION_ARGS);
51 
52 #endif /* TIMESCALEDB_TSL_DATA_NODE_H */
53