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_DIST_UTIL_H
7 #define TIMESCALEDB_TSL_DIST_UTIL_H
8 
9 #include <postgres.h>
10 #include <fmgr.h>
11 #include "hypertable.h"
12 
13 typedef enum DistUtilMembershipStatus
14 {
15 	DIST_MEMBER_NONE,		/* Database doesn't belong to a distributed database */
16 	DIST_MEMBER_DATA_NODE,  /* Database is a data node */
17 	DIST_MEMBER_ACCESS_NODE /* Database is an access node */
18 } DistUtilMembershipStatus;
19 
20 DistUtilMembershipStatus dist_util_membership(void);
21 const char *dist_util_membership_str(DistUtilMembershipStatus status);
22 
23 void dist_util_set_as_access_node(void);
24 bool dist_util_set_id(Datum dist_id);
25 Datum dist_util_get_id(void);
26 bool dist_util_remove_from_db(void);
27 
28 const char *dist_util_internal_key_name(void);
29 
30 void dist_util_set_peer_id(Datum dist_id);
31 bool dist_util_is_access_node_session_on_data_node(void);
32 
33 Datum dist_util_remote_hypertable_info(PG_FUNCTION_ARGS);
34 Datum dist_util_remote_chunk_info(PG_FUNCTION_ARGS);
35 Datum dist_util_remote_compressed_chunk_info(PG_FUNCTION_ARGS);
36 Datum dist_util_remote_hypertable_index_info(PG_FUNCTION_ARGS);
37 
38 void validate_data_node_settings(void);
39 bool dist_util_is_compatible_version(const char *data_node_version, const char *access_node_version,
40 									 bool *is_old_version);
41 
42 #endif /* TIMESCALEDB_TSL_DIST_UTIL_H */
43