This source file includes following definitions.
- cib__client_triggers_refresh
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_CIB_INTERNAL__H
11 #define PCMK__CRM_CIB_INTERNAL__H
12
13 #include <crm/cib.h>
14 #include <crm/common/ipc_internal.h>
15 #include <crm/common/output_internal.h>
16 #include <crm/common/servers_internal.h>
17 #include <crm/common/strings_internal.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23
24 #define PCMK__CIB_REQUEST_SECONDARY "cib_slave"
25 #define PCMK__CIB_REQUEST_PRIMARY "cib_master"
26 #define PCMK__CIB_REQUEST_SYNC_TO_ALL "cib_sync"
27 #define PCMK__CIB_REQUEST_SYNC_TO_ONE "cib_sync_one"
28 #define PCMK__CIB_REQUEST_IS_PRIMARY "cib_ismaster"
29 #define PCMK__CIB_REQUEST_BUMP "cib_bump"
30 #define PCMK__CIB_REQUEST_QUERY "cib_query"
31 #define PCMK__CIB_REQUEST_CREATE "cib_create"
32 #define PCMK__CIB_REQUEST_MODIFY "cib_modify"
33 #define PCMK__CIB_REQUEST_DELETE "cib_delete"
34 #define PCMK__CIB_REQUEST_ERASE "cib_erase"
35 #define PCMK__CIB_REQUEST_REPLACE "cib_replace"
36 #define PCMK__CIB_REQUEST_APPLY_PATCH "cib_apply_diff"
37 #define PCMK__CIB_REQUEST_UPGRADE "cib_upgrade"
38 #define PCMK__CIB_REQUEST_ABS_DELETE "cib_delete_alt"
39 #define PCMK__CIB_REQUEST_NOOP "noop"
40 #define PCMK__CIB_REQUEST_SHUTDOWN "cib_shutdown_req"
41 #define PCMK__CIB_REQUEST_COMMIT_TRANSACT "cib_commit_transact"
42 #define PCMK__CIB_REQUEST_SCHEMAS "cib_schemas"
43
44
45
46
47
48 enum cib__op_attr {
49 cib__op_attr_none = 0,
50 cib__op_attr_modifies = (1 << 1),
51 cib__op_attr_privileged = (1 << 2),
52 cib__op_attr_local = (1 << 3),
53 cib__op_attr_replaces = (1 << 4),
54 cib__op_attr_writes_through = (1 << 5),
55 cib__op_attr_transaction = (1 << 6),
56 };
57
58
59
60
61
62 enum cib__op_type {
63 cib__op_abs_delete,
64 cib__op_apply_patch,
65 cib__op_bump,
66 cib__op_commit_transact,
67 cib__op_create,
68 cib__op_delete,
69 cib__op_erase,
70 cib__op_is_primary,
71 cib__op_modify,
72 cib__op_noop,
73 cib__op_ping,
74 cib__op_primary,
75 cib__op_query,
76 cib__op_replace,
77 cib__op_secondary,
78 cib__op_shutdown,
79 cib__op_sync_all,
80 cib__op_sync_one,
81 cib__op_upgrade,
82 cib__op_schemas,
83 };
84
85 gboolean cib_diff_version_details(xmlNode * diff, int *admin_epoch, int *epoch, int *updates,
86 int *_admin_epoch, int *_epoch, int *_updates);
87
88 gboolean cib_read_config(GHashTable * options, xmlNode * current_cib);
89
90 typedef int (*cib__op_fn_t)(const char *, int, const char *, xmlNode *,
91 xmlNode *, xmlNode *, xmlNode **, xmlNode **);
92
93 typedef struct cib__operation_s {
94 const char *name;
95 enum cib__op_type type;
96 uint32_t flags;
97 } cib__operation_t;
98
99 typedef struct cib_notify_client_s {
100 const char *event;
101 const char *obj_id;
102 const char *obj_type;
103 void (*callback) (const char *event, xmlNode * msg);
104
105 } cib_notify_client_t;
106
107 typedef struct cib_callback_client_s {
108 void (*callback) (xmlNode *, int, int, xmlNode *, void *);
109 const char *id;
110 void *user_data;
111 gboolean only_success;
112 struct timer_rec_s *timer;
113 void (*free_func)(void *);
114 } cib_callback_client_t;
115
116 struct timer_rec_s {
117 int call_id;
118 int timeout;
119 guint ref;
120 cib_t *cib;
121 };
122
123 #define cib__set_call_options(cib_call_opts, call_for, flags_to_set) do { \
124 cib_call_opts = pcmk__set_flags_as(__func__, __LINE__, \
125 LOG_TRACE, "CIB call", (call_for), (cib_call_opts), \
126 (flags_to_set), #flags_to_set); \
127 } while (0)
128
129 #define cib__clear_call_options(cib_call_opts, call_for, flags_to_clear) do { \
130 cib_call_opts = pcmk__clear_flags_as(__func__, __LINE__, \
131 LOG_TRACE, "CIB call", (call_for), (cib_call_opts), \
132 (flags_to_clear), #flags_to_clear); \
133 } while (0)
134
135 cib_t *cib_new_variant(void);
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160 static inline bool
161 cib__client_triggers_refresh(const char *name)
162 {
163 return (pcmk__parse_server(name) == pcmk_ipc_unknown)
164 && !pcmk__str_any_of(name,
165 "attrd_updater",
166 "crm_attribute",
167 "crm_node",
168 "crm_resource",
169 "crm_ticket",
170 NULL);
171 }
172
173 int cib__get_notify_patchset(const xmlNode *msg, const xmlNode **patchset);
174
175 int cib_perform_op(cib_t *cib, const char *op, uint32_t call_options,
176 cib__op_fn_t fn, bool is_query, const char *section,
177 xmlNode *req, xmlNode *input, bool manage_counters,
178 bool *config_changed, xmlNode **current_cib,
179 xmlNode **result_cib, xmlNode **diff, xmlNode **output);
180
181 int cib__create_op(cib_t *cib, const char *op, const char *host,
182 const char *section, xmlNode *data, int call_options,
183 const char *user_name, const char *client_name,
184 xmlNode **op_msg);
185
186 int cib__extend_transaction(cib_t *cib, xmlNode *request);
187
188 void cib_native_callback(cib_t * cib, xmlNode * msg, int call_id, int rc);
189 void cib_native_notify(gpointer data, gpointer user_data);
190
191 int cib__get_operation(const char *op, const cib__operation_t **operation);
192
193 int cib_process_query(const char *op, int options, const char *section, xmlNode * req,
194 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
195 xmlNode ** answer);
196
197 int cib_process_erase(const char *op, int options, const char *section, xmlNode * req,
198 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
199 xmlNode ** answer);
200
201 int cib_process_bump(const char *op, int options, const char *section, xmlNode * req,
202 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
203 xmlNode ** answer);
204
205 int cib_process_replace(const char *op, int options, const char *section, xmlNode * req,
206 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
207 xmlNode ** answer);
208
209 int cib_process_create(const char *op, int options, const char *section, xmlNode * req,
210 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
211 xmlNode ** answer);
212
213 int cib_process_modify(const char *op, int options, const char *section, xmlNode * req,
214 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
215 xmlNode ** answer);
216
217 int cib_process_delete(const char *op, int options, const char *section, xmlNode * req,
218 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
219 xmlNode ** answer);
220
221 int cib_process_diff(const char *op, int options, const char *section, xmlNode * req,
222 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
223 xmlNode ** answer);
224
225 int cib_process_upgrade(const char *op, int options, const char *section, xmlNode * req,
226 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
227 xmlNode ** answer);
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251 int cib_process_xpath(const char *op, int options, const char *section,
252 const xmlNode *req, xmlNode *input, xmlNode *existing_cib,
253 xmlNode **result_cib, xmlNode ** answer);
254
255 int cib_internal_op(cib_t * cib, const char *op, const char *host,
256 const char *section, xmlNode * data,
257 xmlNode ** output_data, int call_options, const char *user_name);
258
259
260 int cib_file_read_and_verify(const char *filename, const char *sigfile,
261 xmlNode **root);
262 int cib_file_write_with_digest(xmlNode *cib_root, const char *cib_dirname,
263 const char *cib_filename);
264
265 void cib__set_output(cib_t *cib, pcmk__output_t *out);
266
267 cib_callback_client_t* cib__lookup_id (int call_id);
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290 int cib__signon_query(pcmk__output_t *out, cib_t **cib, xmlNode **cib_object);
291
292 int cib__signon_attempts(cib_t *cib, enum cib_conn_type type, int attempts);
293
294 int cib__clean_up_connection(cib_t **cib);
295
296 int cib__update_node_attr(pcmk__output_t *out, cib_t *cib, int call_options,
297 const char *section, const char *node_uuid, const char *set_type,
298 const char *set_name, const char *attr_id, const char *attr_name,
299 const char *attr_value, const char *user_name,
300 const char *node_type);
301
302 int cib__get_node_attrs(pcmk__output_t *out, cib_t *cib, const char *section,
303 const char *node_uuid, const char *set_type, const char *set_name,
304 const char *attr_id, const char *attr_name, const char *user_name,
305 xmlNode **result);
306
307 int cib__delete_node_attr(pcmk__output_t *out, cib_t *cib, int options,
308 const char *section, const char *node_uuid, const char *set_type,
309 const char *set_name, const char *attr_id, const char *attr_name,
310 const char *attr_value, const char *user_name);
311
312 #ifdef __cplusplus
313 }
314 #endif
315
316 #endif