pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
cluster.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2024 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef PCMK__CRM_CLUSTER__H
11 #define PCMK__CRM_CLUSTER__H
12 
13 #include <glib.h> // gpointer
14 
15 #if SUPPORT_COROSYNC
16 #include <corosync/cpg.h> // cpg_callbacks_t, etc.
17 #endif
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
25 
26 // Implementation of pcmk_cluster_t
27 // @COMPAT Make contents internal when we can break API backward compatibility
30 struct pcmk__cluster {
31  /* @COMPAT Once all members are moved to pcmk__cluster_private_t, we can
32  * make that the pcmk_cluster_t implementation and drop this struct
33  * altogether, leaving pcmk_cluster_t as an opaque public type.
34  */
37 
38  // NOTE: sbd (as of at least 1.5.2) uses this
40  void (*destroy) (gpointer);
41 
42 #if SUPPORT_COROSYNC
43  // NOTE: sbd (as of at least 1.5.2) uses this
48  cpg_callbacks_t cpg;
49 #endif // SUPPORT_COROSYNC
50 };
52 
55 
58 
60 void pcmk_cluster_free(pcmk_cluster_t *cluster);
61 
62 int pcmk_cluster_set_destroy_fn(pcmk_cluster_t *cluster, void (*fn)(gpointer));
63 #if SUPPORT_COROSYNC
64 int pcmk_cpg_set_deliver_fn(pcmk_cluster_t *cluster, cpg_deliver_fn_t fn);
65 int pcmk_cpg_set_confchg_fn(pcmk_cluster_t *cluster, cpg_confchg_fn_t fn);
66 #endif // SUPPORT_COROSYNC
67 
76 };
77 
79 const char *pcmk_cluster_layer_text(enum pcmk_cluster_layer layer);
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
86 #include <crm/cluster/compat.h>
87 #endif
88 
89 #endif // PCMK__CRM_CLUSTER__H
int pcmk_cluster_disconnect(pcmk_cluster_t *cluster)
Disconnect from the cluster layer.
Definition: cluster.c:113
pcmk_cluster_t * pcmk_cluster_new(void)
Allocate a new pcmk_cluster_t object.
Definition: cluster.c:145
Implementation of pcmk__cluster_private_t.
Definition: internal.h:91
Corosync Cluster Engine.
Definition: cluster.h:75
const char * pcmk_cluster_layer_text(enum pcmk_cluster_layer layer)
Get a log-friendly string equivalent of a cluster layer.
Definition: cluster.c:352
int pcmk_cluster_connect(pcmk_cluster_t *cluster)
Definition: cluster.c:78
void pcmk_cluster_free(pcmk_cluster_t *cluster)
Free a pcmk_cluster_t object and its dynamically allocated members.
Definition: cluster.c:160
void(* destroy)(gpointer)
Definition: cluster.h:40
int pcmk_cluster_set_destroy_fn(pcmk_cluster_t *cluster, void(*fn)(gpointer))
Set the destroy function for a cluster object.
Definition: cluster.c:180
int pcmk_cpg_set_deliver_fn(pcmk_cluster_t *cluster, cpg_deliver_fn_t fn)
Set the CPG deliver callback function for a cluster object.
Definition: cpg.c:746
int pcmk_cpg_set_confchg_fn(pcmk_cluster_t *cluster, cpg_confchg_fn_t fn)
Set the CPG config change callback function for a cluster object.
Definition: cpg.c:764
Deprecated Pacemaker cluster API.
Invalid cluster layer.
Definition: cluster.h:74
pcmk_cluster_layer
Types of cluster layer.
Definition: cluster.h:72
Unknown cluster layer.
Definition: cluster.h:73
pcmk__cluster_private_t * priv
Definition: cluster.h:36
enum pcmk_cluster_layer pcmk_get_cluster_layer(void)
Get and validate the local cluster layer.
Definition: cluster.c:379