pacemaker  2.1.9-49aab99839
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 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
35  cib_database = 4,
37 #endif // !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
38 };
39 
40 enum cib_state {
41  // NOTE: sbd (as of at least 1.5.2) uses this value
43 
44  // NOTE: sbd (as of at least 1.5.2) uses this value
46 
48 };
49 
52 
53  // NOTE: sbd (as of at least 1.5.2) uses this value
55 
58 };
59 
61  cib_none = 0,
62  cib_verbose = (1 << 0),
63  cib_xpath = (1 << 1),
64  cib_multiple = (1 << 2),
65  cib_can_create = (1 << 3),
66  cib_discard_reply = (1 << 4),
67  cib_no_children = (1 << 5),
68  cib_xpath_address = (1 << 6),
69 
71  cib_mixed_update = (1 << 7),
72 
73  /* @COMPAT: cib_scope_local is processed only in the legacy function
74  * parse_local_options_v1().
75  *
76  * If (host == NULL):
77  * * In legacy mode, the CIB manager forwards a request to the primary
78  * instance unless cib_scope_local is set or the local node is primary.
79  * * Outside of legacy mode:
80  * * If a request modifies the CIB, the CIB manager forwards it to all
81  * nodes.
82  * * Otherwise, the CIB manager processes the request locally.
83  *
84  * There is no current use case for this implementing this flag in
85  * non-legacy mode.
86  */
87 
88  // NOTE: sbd (as of at least 1.5.2) uses this value
90  cib_scope_local = (1 << 8),
91 
92  cib_dryrun = (1 << 9),
93 
108  cib_transaction = (1 << 10),
109 
130  cib_score_update = (1 << 11),
131 
132  // NOTE: sbd (as of at least 1.5.2) uses this value
133  cib_sync_call = (1 << 12),
134 
135  cib_no_mtime = (1 << 13),
136 
137 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
138  cib_zero_copy = (1 << 14),
140 #endif // !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
141 
142  cib_inhibit_notify = (1 << 16),
143 
144 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
145  cib_quorum_override = (1 << 20),
147 #endif // !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
148 
150  cib_inhibit_bcast = (1 << 24),
151 
152  cib_force_diff = (1 << 28),
153 };
154 
155 typedef struct cib_s cib_t;
156 
157 typedef struct cib_api_operations_s {
158  // NOTE: sbd (as of at least 1.5.2) uses this
159  int (*signon) (cib_t *cib, const char *name, enum cib_conn_type type);
160 
162  int (*signon_raw) (cib_t *cib, const char *name, enum cib_conn_type type,
163  int *event_fd);
164 
165  // NOTE: sbd (as of at least 1.5.2) uses this
166  int (*signoff) (cib_t *cib);
167 
168  int (*free) (cib_t *cib);
169 
171  int (*set_op_callback) (cib_t *cib, void (*callback) (const xmlNode *msg,
172  int callid, int rc,
173  xmlNode *output));
174 
175  // NOTE: sbd (as of at least 1.5.2) uses this
176  int (*add_notify_callback) (cib_t *cib, const char *event,
177  void (*callback) (const char *event,
178  xmlNode *msg));
179 
180  // NOTE: sbd (as of at least 1.5.2) uses this
181  int (*del_notify_callback) (cib_t *cib, const char *event,
182  void (*callback) (const char *event,
183  xmlNode *msg));
184  // NOTE: sbd (as of at least 1.5.2) uses this
186  void (*dnotify) (gpointer user_data));
187 
189  int (*inputfd) (cib_t *cib);
190 
191  // NOTE: sbd (as of at least 1.5.2) uses this
193  int (*noop) (cib_t *cib, int call_options);
194 
195  int (*ping) (cib_t *cib, xmlNode **output_data, int call_options);
196 
197  // NOTE: sbd (as of at least 1.5.2) uses this
198  int (*query) (cib_t *cib, const char *section, xmlNode **output_data,
199  int call_options);
200 
201  int (*query_from) (cib_t *cib, const char *host, const char *section,
202  xmlNode **output_data, int call_options);
203 
205  int (*is_master) (cib_t *cib);
206 
208  int (*set_master) (cib_t *cib, int call_options);
209 
211  int (*set_slave) (cib_t *cib, int call_options);
212 
214  int (*set_slave_all) (cib_t *cib, int call_options);
215 
216  int (*sync) (cib_t *cib, const char *section, int call_options);
217  int (*sync_from) (cib_t *cib, const char *host, const char *section,
218  int call_options);
219  int (*upgrade) (cib_t *cib, int call_options);
220  int (*bump_epoch) (cib_t *cib, int call_options);
221 
226  int (*create) (cib_t *cib, const char *section, xmlNode *data,
227  int call_options);
228  int (*modify) (cib_t *cib, const char *section, xmlNode *data,
229  int call_options);
230 
232  int (*update) (cib_t *cib, const char *section, xmlNode *data,
233  int call_options);
234 
235  int (*replace) (cib_t *cib, const char *section, xmlNode *data,
236  int call_options);
237  int (*remove) (cib_t *cib, const char *section, xmlNode *data,
238  int call_options);
239  int (*erase) (cib_t *cib, xmlNode **output_data, int call_options);
240 
242  int (*delete_absolute) (cib_t *cib, const char *section, xmlNode *data,
243  int call_options);
244 
246  int (*quit) (cib_t *cib, int call_options);
247 
248  int (*register_notification) (cib_t *cib, const char *callback,
249  int enabled);
250  gboolean (*register_callback) (cib_t *cib, int call_id, int timeout,
251  gboolean only_success, void *user_data,
252  const char *callback_name,
253  void (*callback) (xmlNode*, int, int,
254  xmlNode*, void *));
255  gboolean (*register_callback_full)(cib_t *cib, int call_id, int timeout,
256  gboolean only_success, void *user_data,
257  const char *callback_name,
258  void (*callback)(xmlNode *, int, int,
259  xmlNode *, void *),
260  void (*free_func)(void *));
261 
270  int (*set_primary)(cib_t *cib, int call_options);
271 
280  int (*set_secondary)(cib_t *cib, int call_options);
281 
299  int (*client_id)(const cib_t *cib, const char **async_id,
300  const char **sync_id);
301 
336  int (*init_transaction)(cib_t *cib);
337 
362  int (*end_transaction)(cib_t *cib, bool commit, int call_options);
363 
374  void (*set_user)(cib_t *cib, const char *user);
375 
376  int (*fetch_schemas)(cib_t *cib, xmlNode **output_data, const char *after_ver,
377  int call_options);
379 
380 struct cib_s {
381  // NOTE: sbd (as of at least 1.5.2) uses this
383 
386 
387  int call_id;
390  void *delegate_fn;
391 
392  GList *notify_list;
393 
395  void (*op_callback) (const xmlNode *msg, int call_id, int rc,
396  xmlNode *output);
397 
398  // NOTE: sbd (as of at least 1.5.2) uses this
400 
401  xmlNode *transaction;
402 
403  char *user;
404 };
405 
406 #ifdef __cplusplus
407 }
408 #endif
409 
410 #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:250
char data[0]
Definition: cpg.c:58
int call_timeout
Definition: cib_types.h:388
const char * name
Definition: cib.c:26
int(* delete_absolute)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib_types.h:242
int(* signoff)(cib_t *cib)
Definition: cib_types.h:166
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:255
int(* signon_raw)(cib_t *cib, const char *name, enum cib_conn_type type, int *event_fd)
Definition: cib_types.h:162
int(* inputfd)(cib_t *cib)
Definition: cib_types.h:189
enum crm_ais_msg_types type
Definition: cpg.c:51
int(* fetch_schemas)(cib_t *cib, xmlNode **output_data, const char *after_ver, int call_options)
Definition: cib_types.h:376
int(* set_secondary)(cib_t *cib, int call_options)
Set the local CIB manager as a secondary instance.
Definition: cib_types.h:280
int(* set_op_callback)(cib_t *cib, void(*callback)(const xmlNode *msg, int callid, int rc, xmlNode *output))
Definition: cib_types.h:171
int(* sync)(cib_t *cib, const char *section, int call_options)
Definition: cib_types.h:216
int(* set_connection_dnotify)(cib_t *cib, void(*dnotify)(gpointer user_data))
Definition: cib_types.h:185
int(* query_from)(cib_t *cib, const char *host, const char *section, xmlNode **output_data, int call_options)
Definition: cib_types.h:201
cib_api_operations_t * cmds
Definition: cib_types.h:399
int(* set_slave)(cib_t *cib, int call_options)
Definition: cib_types.h:211
cib_conn_type
Definition: cib_types.h:50
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
Definition: cib_types.h:159
cib_variant
Definition: cib_types.h:28
int(* quit)(cib_t *cib, int call_options)
Definition: cib_types.h:246
cib_call_options
Definition: cib_types.h:60
int(* modify)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib_types.h:228
void(* op_callback)(const xmlNode *msg, int call_id, int rc, xmlNode *output)
Definition: cib_types.h:395
int(* create)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib_types.h:226
Wrappers for and extensions to libxml2.
int(* query)(cib_t *cib, const char *section, xmlNode **output_data, int call_options)
Definition: cib_types.h:198
int(* is_master)(cib_t *cib)
Definition: cib_types.h:205
xmlNode * transaction
Definition: cib_types.h:401
int(* replace)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib_types.h:235
int(* add_notify_callback)(cib_t *cib, const char *event, void(*callback)(const char *event, xmlNode *msg))
Definition: cib_types.h:176
int(* sync_from)(cib_t *cib, const char *host, const char *section, int call_options)
Definition: cib_types.h:217
int(* register_notification)(cib_t *cib, const char *callback, int enabled)
Definition: cib_types.h:248
int(* ping)(cib_t *cib, xmlNode **output_data, int call_options)
Definition: cib_types.h:195
int(* update)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib_types.h:232
void * variant_opaque
Definition: cib_types.h:389
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:270
int(* noop)(cib_t *cib, int call_options)
Definition: cib_types.h:193
char * user
Definition: cib_types.h:403
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:362
int(* set_slave_all)(cib_t *cib, int call_options)
Definition: cib_types.h:214
int(* del_notify_callback)(cib_t *cib, const char *event, void(*callback)(const char *event, xmlNode *msg))
Definition: cib_types.h:181
struct cib_api_operations_s cib_api_operations_t
Prefer stderr to logs.
Definition: cib_types.h:62
int(* set_master)(cib_t *cib, int call_options)
Definition: cib_types.h:208
enum cib_variant variant
Definition: cib_types.h:385
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:374
int call_id
Definition: cib_types.h:387
int(* bump_epoch)(cib_t *cib, int call_options)
Definition: cib_types.h:220
int(* init_transaction)(cib_t *cib)
Initiate an atomic CIB transaction for this client.
Definition: cib_types.h:336
enum cib_conn_type type
Definition: cib_types.h:384
enum cib_state state
Definition: cib_types.h:382
GList * notify_list
Definition: cib_types.h:392
Treat new attribute values as atomic score updates where possible.
Definition: cib_types.h:130
int(* free)(cib_t *cib)
Definition: cib_types.h:168
unsigned int timeout
Definition: pcmk_fence.c:32
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:299
int(* upgrade)(cib_t *cib, int call_options)
Definition: cib_types.h:219
Process request when the client commits the active transaction.
Definition: cib_types.h:108
cib_state
Definition: cib_types.h:40
int(* erase)(cib_t *cib, xmlNode **output_data, int call_options)
Definition: cib_types.h:239
void * delegate_fn
Definition: cib_types.h:390