pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
cib_types.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_CIB_CIB_TYPES__H
11 # define PCMK__CRM_CIB_CIB_TYPES__H
12 
13 # include <glib.h> // gboolean, GList
14 # include <libxml/tree.h> // xmlNode
15 # include <crm/common/ipc.h>
16 # include <crm/common/xml.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
31  cib_file = 2,
33 };
34 
35 enum cib_state {
36  // NOTE: sbd (as of at least 1.5.2) uses this value
38 
39  // NOTE: sbd (as of at least 1.5.2) uses this value
41 
43 };
44 
47 
48  // NOTE: sbd (as of at least 1.5.2) uses this value
50 
53 };
54 
56  cib_none = 0,
57  cib_verbose = (1 << 0),
58  cib_xpath = (1 << 1),
59  cib_multiple = (1 << 2),
60  cib_can_create = (1 << 3),
61  cib_discard_reply = (1 << 4),
62  cib_no_children = (1 << 5),
63  cib_xpath_address = (1 << 6),
64 
65 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
66  // NOTE: sbd (as of at least 1.5.2) uses this value
68  cib_scope_local = (1 << 8),
69 #endif // !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
70 
71  cib_dryrun = (1 << 9),
72 
87  cib_transaction = (1 << 10),
88 
109  cib_score_update = (1 << 11),
110 
111  // NOTE: sbd (as of at least 1.5.2) uses this value
112  cib_sync_call = (1 << 12),
113 
114  cib_no_mtime = (1 << 13),
115  cib_inhibit_notify = (1 << 16),
116  cib_force_diff = (1 << 28),
117 };
118 
119 typedef struct cib_s cib_t;
120 
121 typedef struct cib_api_operations_s {
122  // NOTE: sbd (as of at least 1.5.2) uses this
123  // @COMPAT At compatibility break, drop name (always use crm_system_name)
124  int (*signon) (cib_t *cib, const char *name, enum cib_conn_type type);
125 
126  // NOTE: sbd (as of at least 1.5.2) uses this
127  int (*signoff) (cib_t *cib);
128 
129  int (*free) (cib_t *cib);
130 
131  // NOTE: sbd (as of at least 1.5.2) uses this
132  int (*add_notify_callback) (cib_t *cib, const char *event,
133  void (*callback) (const char *event,
134  xmlNode *msg));
135 
136  // NOTE: sbd (as of at least 1.5.2) uses this
137  int (*del_notify_callback) (cib_t *cib, const char *event,
138  void (*callback) (const char *event,
139  xmlNode *msg));
140  // NOTE: sbd (as of at least 1.5.2) uses this
142  void (*dnotify) (gpointer user_data));
143 
144  // NOTE: sbd (as of at least 1.5.2) uses this
146  int (*noop) (cib_t *cib, int call_options);
147 
148  int (*ping) (cib_t *cib, xmlNode **output_data, int call_options);
149 
150  // NOTE: sbd (as of at least 1.5.2) uses this
151  int (*query) (cib_t *cib, const char *section, xmlNode **output_data,
152  int call_options);
153 
154  int (*query_from) (cib_t *cib, const char *host, const char *section,
155  xmlNode **output_data, int call_options);
156 
157  int (*sync) (cib_t *cib, const char *section, int call_options);
158  int (*sync_from) (cib_t *cib, const char *host, const char *section,
159  int call_options);
160  int (*upgrade) (cib_t *cib, int call_options);
161  int (*bump_epoch) (cib_t *cib, int call_options);
162 
167  int (*create) (cib_t *cib, const char *section, xmlNode *data,
168  int call_options);
169  int (*modify) (cib_t *cib, const char *section, xmlNode *data,
170  int call_options);
171 
172  int (*replace) (cib_t *cib, const char *section, xmlNode *data,
173  int call_options);
174  int (*remove) (cib_t *cib, const char *section, xmlNode *data,
175  int call_options);
176  int (*erase) (cib_t *cib, xmlNode **output_data, int call_options);
177 
178  int (*register_notification) (cib_t *cib, const char *callback,
179  int enabled);
180  gboolean (*register_callback) (cib_t *cib, int call_id, int timeout,
181  gboolean only_success, void *user_data,
182  const char *callback_name,
183  void (*callback) (xmlNode*, int, int,
184  xmlNode*, void *));
185  gboolean (*register_callback_full)(cib_t *cib, int call_id, int timeout,
186  gboolean only_success, void *user_data,
187  const char *callback_name,
188  void (*callback)(xmlNode *, int, int,
189  xmlNode *, void *),
190  void (*free_func)(void *));
191 
200  int (*set_primary)(cib_t *cib, int call_options);
201 
210  int (*set_secondary)(cib_t *cib, int call_options);
211 
229  int (*client_id)(const cib_t *cib, const char **async_id,
230  const char **sync_id);
231 
266  int (*init_transaction)(cib_t *cib);
267 
292  int (*end_transaction)(cib_t *cib, bool commit, int call_options);
293 
304  void (*set_user)(cib_t *cib, const char *user);
305 
306  int (*fetch_schemas)(cib_t *cib, xmlNode **output_data, const char *after_ver,
307  int call_options);
309 
310 struct cib_s {
311  // NOTE: sbd (as of at least 1.5.2) uses this
313 
316 
317  int call_id;
320  void *delegate_fn;
321 
322  GList *notify_list;
323 
324  // NOTE: sbd (as of at least 1.5.2) uses this
326 
327  xmlNode *transaction;
328 
329  char *user;
330 };
331 
332 #ifdef __cplusplus
333 }
334 #endif
335 
336 #endif // PCMK__CRM_CIB_CIB_TYPES__H
pcmk__cpg_host_t host
Definition: cpg.c:52
gboolean(* register_callback)(cib_t *cib, int call_id, int timeout, gboolean only_success, void *user_data, const char *callback_name, void(*callback)(xmlNode *, int, int, xmlNode *, void *))
Definition: cib_types.h:180
char data[0]
Definition: cpg.c:58
int call_timeout
Definition: cib_types.h:318
const char * name
Definition: cib.c:26
enum pcmk_ipc_server type
Definition: cpg.c:51
int(* signoff)(cib_t *cib)
Definition: cib_types.h:127
gboolean(* register_callback_full)(cib_t *cib, int call_id, int timeout, gboolean only_success, void *user_data, const char *callback_name, void(*callback)(xmlNode *, int, int, xmlNode *, void *), void(*free_func)(void *))
Definition: cib_types.h:185
int(* fetch_schemas)(cib_t *cib, xmlNode **output_data, const char *after_ver, int call_options)
Definition: cib_types.h:306
int(* set_secondary)(cib_t *cib, int call_options)
Set the local CIB manager as a secondary instance.
Definition: cib_types.h:210
int(* sync)(cib_t *cib, const char *section, int call_options)
Definition: cib_types.h:157
int(* set_connection_dnotify)(cib_t *cib, void(*dnotify)(gpointer user_data))
Definition: cib_types.h:141
int(* query_from)(cib_t *cib, const char *host, const char *section, xmlNode **output_data, int call_options)
Definition: cib_types.h:154
cib_api_operations_t * cmds
Definition: cib_types.h:325
cib_conn_type
Definition: cib_types.h:45
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
Definition: cib_types.h:124
cib_variant
Definition: cib_types.h:28
cib_call_options
Definition: cib_types.h:55
int(* modify)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib_types.h:169
int(* create)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib_types.h:167
Wrappers for and extensions to libxml2.
int(* query)(cib_t *cib, const char *section, xmlNode **output_data, int call_options)
Definition: cib_types.h:151
xmlNode * transaction
Definition: cib_types.h:327
int(* replace)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib_types.h:172
int(* add_notify_callback)(cib_t *cib, const char *event, void(*callback)(const char *event, xmlNode *msg))
Definition: cib_types.h:132
#define PCMK_ALLOW_DEPRECATED
Allow use of deprecated Pacemaker APIs.
Definition: crm.h:46
int(* sync_from)(cib_t *cib, const char *host, const char *section, int call_options)
Definition: cib_types.h:158
int(* register_notification)(cib_t *cib, const char *callback, int enabled)
Definition: cib_types.h:178
int(* ping)(cib_t *cib, xmlNode **output_data, int call_options)
Definition: cib_types.h:148
void * variant_opaque
Definition: cib_types.h:319
int(* set_primary)(cib_t *cib, int call_options)
Set the local CIB manager as the cluster&#39;s primary instance.
Definition: cib_types.h:200
int(* noop)(cib_t *cib, int call_options)
Definition: cib_types.h:146
char * user
Definition: cib_types.h:329
int(* end_transaction)(cib_t *cib, bool commit, int call_options)
End and optionally commit this client&#39;s CIB transaction.
Definition: cib_types.h:292
int(* del_notify_callback)(cib_t *cib, const char *event, void(*callback)(const char *event, xmlNode *msg))
Definition: cib_types.h:137
struct cib_api_operations_s cib_api_operations_t
Prefer stderr to logs.
Definition: cib_types.h:57
enum cib_variant variant
Definition: cib_types.h:315
IPC interface to Pacemaker daemons.
void(* set_user)(cib_t *cib, const char *user)
Set the user as whom all CIB requests via methods will be executed.
Definition: cib_types.h:304
int call_id
Definition: cib_types.h:317
int(* bump_epoch)(cib_t *cib, int call_options)
Definition: cib_types.h:161
int(* init_transaction)(cib_t *cib)
Initiate an atomic CIB transaction for this client.
Definition: cib_types.h:266
enum cib_conn_type type
Definition: cib_types.h:314
enum cib_state state
Definition: cib_types.h:312
GList * notify_list
Definition: cib_types.h:322
Treat new attribute values as atomic score updates where possible.
Definition: cib_types.h:109
int(* free)(cib_t *cib)
Definition: cib_types.h:129
unsigned int timeout
Definition: pcmk_fence.c:34
int(* client_id)(const cib_t *cib, const char **async_id, const char **sync_id)
Get the given CIB connection&#39;s unique client identifier(s)
Definition: cib_types.h:229
int(* upgrade)(cib_t *cib, int call_options)
Definition: cib_types.h:160
Process request when the client commits the active transaction.
Definition: cib_types.h:87
cib_state
Definition: cib_types.h:35
int(* erase)(cib_t *cib, xmlNode **output_data, int call_options)
Definition: cib_types.h:176
void * delegate_fn
Definition: cib_types.h:320