4 Copyright (C) Amitay Isaacs 2015
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef __CTDB_CLIENT_H__
21 #define __CTDB_CLIENT_H__
26 #include "protocol/protocol.h"
27 #include "common/srvid.h"
29 struct ctdb_client_context
;
30 struct ctdb_db_context
;
31 struct ctdb_record_handle
;
33 typedef void (*ctdb_client_callback_func_t
)(void *private_data
);
35 /* from client/client_connect.c */
37 int ctdb_client_init(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
38 const char *sockpath
, struct ctdb_client_context
**ret
);
40 void ctdb_client_set_disconnect_callback(struct ctdb_client_context
*client
,
41 ctdb_client_callback_func_t func
,
44 uint32_t ctdb_client_pnn(struct ctdb_client_context
*client
);
46 void ctdb_client_wait(struct tevent_context
*ev
, bool *done
);
48 int ctdb_client_wait_timeout(struct tevent_context
*ev
, bool *done
,
49 struct timeval timeout
);
51 struct tevent_req
*ctdb_recovery_wait_send(TALLOC_CTX
*mem_ctx
,
52 struct tevent_context
*ev
,
53 struct ctdb_client_context
*client
);
55 bool ctdb_recovery_wait_recv(struct tevent_req
*req
, int *perr
);
57 bool ctdb_recovery_wait(struct tevent_context
*ev
,
58 struct ctdb_client_context
*client
);
60 /* from client/client_call.c */
62 struct tevent_req
*ctdb_client_call_send(TALLOC_CTX
*mem_ctx
,
63 struct tevent_context
*ev
,
64 struct ctdb_client_context
*client
,
65 struct ctdb_req_call
*request
);
67 bool ctdb_client_call_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
68 struct ctdb_reply_call
**reply
, int *perr
);
71 /* from client/client_message.c */
73 struct tevent_req
*ctdb_client_message_send(TALLOC_CTX
*mem_ctx
,
74 struct tevent_context
*ev
,
75 struct ctdb_client_context
*client
,
77 struct ctdb_req_message
*message
);
79 bool ctdb_client_message_recv(struct tevent_req
*req
, int *perr
);
81 struct tevent_req
*ctdb_client_message_multi_send(
83 struct tevent_context
*ev
,
84 struct ctdb_client_context
*client
,
85 uint32_t *pnn_list
, int count
,
86 struct ctdb_req_message
*message
);
88 bool ctdb_client_message_multi_recv(struct tevent_req
*req
, int *perr
,
89 TALLOC_CTX
*mem_ctx
, int **perr_list
);
91 int ctdb_client_message(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
92 struct ctdb_client_context
*client
,
93 uint32_t destnode
, struct ctdb_req_message
*message
);
95 struct tevent_req
*ctdb_client_set_message_handler_send(
97 struct tevent_context
*ev
,
98 struct ctdb_client_context
*client
,
100 srvid_handler_fn handler
,
102 bool ctdb_client_set_message_handler_recv(struct tevent_req
*req
, int *perr
);
104 struct tevent_req
*ctdb_client_remove_message_handler_send(
106 struct tevent_context
*ev
,
107 struct ctdb_client_context
*client
,
110 bool ctdb_client_remove_message_handler_recv(struct tevent_req
*req
,
113 int ctdb_client_set_message_handler(struct tevent_context
*ev
,
114 struct ctdb_client_context
*client
,
115 uint64_t srvid
, srvid_handler_fn handler
,
118 int ctdb_client_remove_message_handler(struct tevent_context
*ev
,
119 struct ctdb_client_context
*client
,
120 uint64_t srvid
, void *private_data
);
122 /* from client/client_message_sync.c */
124 int ctdb_message_recd_update_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
125 struct ctdb_client_context
*client
,
126 int destnode
, struct ctdb_public_ip
*pubip
);
128 int ctdb_message_mem_dump(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
129 struct ctdb_client_context
*client
,
130 int destnode
, struct ctdb_srvid_message
*msg
);
132 int ctdb_message_reload_nodes(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
133 struct ctdb_client_context
*client
,
136 int ctdb_message_takeover_run(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
137 struct ctdb_client_context
*client
,
138 int destnode
, struct ctdb_srvid_message
*msg
);
140 int ctdb_message_rebalance_node(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
141 struct ctdb_client_context
*client
,
142 int destnode
, uint32_t pnn
);
144 int ctdb_message_disable_takeover_runs(TALLOC_CTX
*mem_ctx
,
145 struct tevent_context
*ev
,
146 struct ctdb_client_context
*client
,
148 struct ctdb_disable_message
*disable
);
150 int ctdb_message_disable_recoveries(TALLOC_CTX
*mem_ctx
,
151 struct tevent_context
*ev
,
152 struct ctdb_client_context
*client
,
154 struct ctdb_disable_message
*disable
);
156 int ctdb_message_disable_ip_check(TALLOC_CTX
*mem_ctx
,
157 struct tevent_context
*ev
,
158 struct ctdb_client_context
*client
,
159 int destnode
, uint32_t timeout
);
161 /* from client/client_control.c */
163 struct tevent_req
*ctdb_client_control_send(TALLOC_CTX
*mem_ctx
,
164 struct tevent_context
*ev
,
165 struct ctdb_client_context
*client
,
167 struct timeval timeout
,
168 struct ctdb_req_control
*request
);
170 bool ctdb_client_control_recv(struct tevent_req
*req
, int *perr
,
172 struct ctdb_reply_control
**preply
);
174 struct tevent_req
*ctdb_client_control_multi_send(
176 struct tevent_context
*ev
,
177 struct ctdb_client_context
*client
,
178 uint32_t *pnn_list
, int count
,
179 struct timeval timeout
,
180 struct ctdb_req_control
*request
);
182 bool ctdb_client_control_multi_recv(struct tevent_req
*req
, int *perr
,
183 TALLOC_CTX
*mem_ctx
, int **perr_list
,
184 struct ctdb_reply_control
***preply
);
186 int ctdb_client_control_multi_error(uint32_t *pnn_list
, int count
,
187 int *err_list
, uint32_t *pnn
);
189 int ctdb_client_control(TALLOC_CTX
*mem_ctx
,
190 struct tevent_context
*ev
,
191 struct ctdb_client_context
*client
,
193 struct timeval timeout
,
194 struct ctdb_req_control
*c
,
195 struct ctdb_reply_control
**preply
);
197 int ctdb_client_control_multi(TALLOC_CTX
*mem_ctx
,
198 struct tevent_context
*ev
,
199 struct ctdb_client_context
*client
,
200 uint32_t *pnn_list
, int count
,
201 struct timeval timeout
,
202 struct ctdb_req_control
*request
,
204 struct ctdb_reply_control
***preply
);
206 /* from client/client_control_sync.c */
208 int ctdb_ctrl_process_exists(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
209 struct ctdb_client_context
*client
,
210 int destnode
, struct timeval timeout
,
211 pid_t pid
, int *status
);
213 int ctdb_ctrl_statistics(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
214 struct ctdb_client_context
*client
,
215 int destnode
, struct timeval timeout
,
216 struct ctdb_statistics
**stats
);
218 int ctdb_ctrl_ping(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
219 struct ctdb_client_context
*client
,
220 int destnode
, struct timeval timeout
,
223 int ctdb_ctrl_getdbpath(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
224 struct ctdb_client_context
*client
,
225 int destnode
, struct timeval timeout
,
226 uint32_t db_id
, const char **db_path
);
228 int ctdb_ctrl_getvnnmap(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
229 struct ctdb_client_context
*client
,
230 int destnode
, struct timeval timeout
,
231 struct ctdb_vnn_map
**vnnmap
);
233 int ctdb_ctrl_getdebug(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
234 struct ctdb_client_context
*client
,
235 int destnode
, struct timeval timeout
,
238 int ctdb_ctrl_setdebug(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
239 struct ctdb_client_context
*client
,
240 int destnode
, struct timeval timeout
,
243 int ctdb_ctrl_get_dbmap(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
244 struct ctdb_client_context
*client
,
245 int destnode
, struct timeval timeout
,
246 struct ctdb_dbid_map
**dbmap
);
248 int ctdb_ctrl_pull_db(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
249 struct ctdb_client_context
*client
, int destnode
,
250 struct timeval timeout
, struct ctdb_pulldb
*pulldb
,
251 struct ctdb_rec_buffer
**recbuf
);
253 int ctdb_ctrl_push_db(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
254 struct ctdb_client_context
*client
, int destnode
,
255 struct timeval timeout
, struct ctdb_rec_buffer
*recbuf
);
257 int ctdb_ctrl_get_recmode(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
258 struct ctdb_client_context
*client
,
259 int destnode
, struct timeval timeout
,
262 int ctdb_ctrl_set_recmode(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
263 struct ctdb_client_context
*client
,
264 int destnode
, struct timeval timeout
,
267 int ctdb_ctrl_statistics_reset(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
268 struct ctdb_client_context
*client
,
269 int destnode
, struct timeval timeout
);
271 int ctdb_ctrl_db_attach(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
272 struct ctdb_client_context
*client
,
273 int destnode
, struct timeval timeout
,
274 const char *db_name
, uint32_t tdb_flags
,
277 int ctdb_ctrl_traverse_start(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
278 struct ctdb_client_context
*client
,
279 int destnode
, struct timeval timeout
,
280 struct ctdb_traverse_start
*traverse
);
282 int ctdb_ctrl_register_srvid(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
283 struct ctdb_client_context
*client
,
284 int destnode
, struct timeval timeout
,
287 int ctdb_ctrl_deregister_srvid(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
288 struct ctdb_client_context
*client
,
289 int destnode
, struct timeval timeout
,
292 int ctdb_ctrl_get_dbname(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
293 struct ctdb_client_context
*client
,
294 int destnode
, struct timeval timeout
,
295 uint32_t db_id
, const char **db_name
);
297 int ctdb_ctrl_enable_seqnum(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
298 struct ctdb_client_context
*client
,
299 int destnode
, struct timeval timeout
,
302 int ctdb_ctrl_update_seqnum(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
303 struct ctdb_client_context
*client
,
304 int destnode
, struct timeval timeout
,
307 int ctdb_ctrl_dump_memory(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
308 struct ctdb_client_context
*client
,
309 int destnode
, struct timeval timeout
,
310 const char **mem_str
);
312 int ctdb_ctrl_get_pid(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
313 struct ctdb_client_context
*client
,
314 int destnode
, struct timeval timeout
,
317 int ctdb_ctrl_get_recmaster(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
318 struct ctdb_client_context
*client
,
319 int destnode
, struct timeval timeout
,
320 uint32_t *recmaster
);
322 int ctdb_ctrl_set_recmaster(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
323 struct ctdb_client_context
*client
,
324 int destnode
, struct timeval timeout
,
327 int ctdb_ctrl_freeze(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
328 struct ctdb_client_context
*client
,
329 int destnode
, struct timeval timeout
,
332 int ctdb_ctrl_thaw(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
333 struct ctdb_client_context
*client
,
334 int destnode
, struct timeval timeout
,
337 int ctdb_ctrl_get_pnn(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
338 struct ctdb_client_context
*client
,
339 int destnode
, struct timeval timeout
,
342 int ctdb_ctrl_shutdown(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
343 struct ctdb_client_context
*client
,
344 int destnode
, struct timeval timeout
);
346 int ctdb_ctrl_get_monmode(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
347 struct ctdb_client_context
*client
,
348 int destnode
, struct timeval timeout
,
351 int ctdb_ctrl_tcp_add(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
352 struct ctdb_client_context
*client
,
353 int destnode
, struct timeval timeout
,
354 struct ctdb_connection
*conn
);
356 int ctdb_ctrl_tcp_remove(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
357 struct ctdb_client_context
*client
,
358 int destnode
, struct timeval timeout
,
359 struct ctdb_connection
*conn
);
361 int ctdb_ctrl_set_tunable(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
362 struct ctdb_client_context
*client
,
363 int destnode
, struct timeval timeout
,
364 struct ctdb_tunable
*tunable
);
366 int ctdb_ctrl_get_tunable(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
367 struct ctdb_client_context
*client
,
368 int destnode
, struct timeval timeout
,
369 const char *var
, uint32_t *value
);
371 int ctdb_ctrl_list_tunables(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
372 struct ctdb_client_context
*client
,
373 int destnode
, struct timeval timeout
,
374 struct ctdb_var_list
**var_list
);
376 int ctdb_ctrl_modify_flags(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
377 struct ctdb_client_context
*client
,
378 int destnode
, struct timeval timeout
,
379 uint32_t pnn
, uint32_t old_flags
,
382 int ctdb_ctrl_get_all_tunables(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
383 struct ctdb_client_context
*client
,
384 int destnode
, struct timeval timeout
,
385 struct ctdb_tunable_list
**tun_list
);
387 int ctdb_ctrl_get_tcp_tickle_list(TALLOC_CTX
*mem_ctx
,
388 struct tevent_context
*ev
,
389 struct ctdb_client_context
*client
,
390 int destnode
, struct timeval timeout
,
391 ctdb_sock_addr
*addr
,
392 struct ctdb_tickle_list
**tickles
);
394 int ctdb_ctrl_set_tcp_tickle_list(TALLOC_CTX
*mem_ctx
,
395 struct tevent_context
*ev
,
396 struct ctdb_client_context
*client
,
397 int destnode
, struct timeval timeout
,
398 struct ctdb_tickle_list
*tickles
);
400 int ctdb_ctrl_db_attach_persistent(TALLOC_CTX
*mem_ctx
,
401 struct tevent_context
*ev
,
402 struct ctdb_client_context
*client
,
403 int destnode
, struct timeval timeout
,
404 const char *db_name
, int tdb_flags
,
407 int ctdb_ctrl_send_gratuitous_arp(TALLOC_CTX
*mem_ctx
,
408 struct tevent_context
*ev
,
409 struct ctdb_client_context
*client
,
410 int destnode
, struct timeval timeout
,
411 struct ctdb_addr_info
*addr_info
);
413 int ctdb_ctrl_transaction_start(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
414 struct ctdb_client_context
*client
,
415 int destnode
, struct timeval timeout
,
418 int ctdb_ctrl_transaction_commit(TALLOC_CTX
*mem_ctx
,
419 struct tevent_context
*ev
,
420 struct ctdb_client_context
*client
,
421 int destnode
, struct timeval timeout
,
424 int ctdb_ctrl_wipe_database(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
425 struct ctdb_client_context
*client
,
426 int destnode
, struct timeval timeout
,
427 uint32_t db_id
, uint32_t tid
);
429 int ctdb_ctrl_uptime(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
430 struct ctdb_client_context
*client
,
431 int destnode
, struct timeval timeout
,
432 struct ctdb_uptime
**uptime
);
434 int ctdb_ctrl_start_recovery(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
435 struct ctdb_client_context
*client
,
436 int destnode
, struct timeval timeout
);
438 int ctdb_ctrl_end_recovery(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
439 struct ctdb_client_context
*client
,
440 int destnode
, struct timeval timeout
);
442 int ctdb_ctrl_reload_nodes_file(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
443 struct ctdb_client_context
*client
,
444 int destnode
, struct timeval timeout
);
446 int ctdb_ctrl_enable_monitor(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
447 struct ctdb_client_context
*client
,
448 int destnode
, struct timeval timeout
);
450 int ctdb_ctrl_disable_monitor(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
451 struct ctdb_client_context
*client
,
452 int destnode
, struct timeval timeout
);
454 int ctdb_ctrl_add_public_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
455 struct ctdb_client_context
*client
,
456 int destnode
, struct timeval timeout
,
457 struct ctdb_addr_info
*addr_info
);
459 int ctdb_ctrl_del_public_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
460 struct ctdb_client_context
*client
,
461 int destnode
, struct timeval timeout
,
462 struct ctdb_addr_info
*addr_info
);
464 int ctdb_ctrl_run_eventscripts(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
465 struct ctdb_client_context
*client
,
466 int destnode
, struct timeval timeout
,
469 int ctdb_ctrl_get_capabilities(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
470 struct ctdb_client_context
*client
,
471 int destnode
, struct timeval timeout
,
474 int ctdb_ctrl_release_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
475 struct ctdb_client_context
*client
,
476 int destnode
, struct timeval timeout
,
477 struct ctdb_public_ip
*pubip
);
479 int ctdb_ctrl_takeover_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
480 struct ctdb_client_context
*client
,
481 int destnode
, struct timeval timeout
,
482 struct ctdb_public_ip
*pubip
);
484 int ctdb_ctrl_get_public_ips(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
485 struct ctdb_client_context
*client
,
486 int destnode
, struct timeval timeout
,
487 struct ctdb_public_ip_list
**pubip_list
);
489 int ctdb_ctrl_get_nodemap(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
490 struct ctdb_client_context
*client
,
491 int destnode
, struct timeval timeout
,
492 struct ctdb_node_map
**nodemap
);
494 int ctdb_ctrl_get_event_script_status(TALLOC_CTX
*mem_ctx
,
495 struct tevent_context
*ev
,
496 struct ctdb_client_context
*client
,
497 int destnode
, struct timeval timeout
,
498 enum ctdb_event event
,
499 struct ctdb_script_list
**slist
);
501 int ctdb_ctrl_traverse_kill(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
502 struct ctdb_client_context
*client
,
503 int destnode
, struct timeval timeout
,
504 struct ctdb_traverse_start
*traverse
);
506 int ctdb_ctrl_get_reclock_file(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
507 struct ctdb_client_context
*client
,
508 int destnode
, struct timeval timeout
,
509 const char **reclock_file
);
511 int ctdb_ctrl_set_reclock_file(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
512 struct ctdb_client_context
*client
,
513 int destnode
, struct timeval timeout
,
514 const char *reclock_file
);
516 int ctdb_ctrl_stop_node(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
517 struct ctdb_client_context
*client
,
518 int destnode
, struct timeval timeout
);
520 int ctdb_ctrl_continue_node(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
521 struct ctdb_client_context
*client
,
522 int destnode
, struct timeval timeout
);
524 int ctdb_ctrl_set_lmasterrole(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
525 struct ctdb_client_context
*client
,
526 int destnode
, struct timeval timeout
,
527 uint32_t lmaster_role
);
529 int ctdb_ctrl_set_recmasterrole(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
530 struct ctdb_client_context
*client
,
531 int destnode
, struct timeval timeout
,
532 uint32_t recmaster_role
);
534 int ctdb_ctrl_enable_script(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
535 struct ctdb_client_context
*client
,
536 int destnode
, struct timeval timeout
,
539 int ctdb_ctrl_disable_script(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
540 struct ctdb_client_context
*client
,
541 int destnode
, struct timeval timeout
,
544 int ctdb_ctrl_set_ban_state(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
545 struct ctdb_client_context
*client
,
546 int destnode
, struct timeval timeout
,
547 struct ctdb_ban_state
*ban_state
);
549 int ctdb_ctrl_get_ban_state(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
550 struct ctdb_client_context
*client
,
551 int destnode
, struct timeval timeout
,
552 struct ctdb_ban_state
**ban_state
);
554 int ctdb_ctrl_set_db_priority(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
555 struct ctdb_client_context
*client
,
556 int destnode
, struct timeval timeout
,
557 uint32_t db_id
, int priority
);
559 int ctdb_ctrl_get_db_priority(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
560 struct ctdb_client_context
*client
,
561 int destnode
, struct timeval timeout
,
562 uint32_t db_id
, uint32_t *priority
);
564 int ctdb_ctrl_transaction_cancel(TALLOC_CTX
*mem_ctx
,
565 struct tevent_context
*ev
,
566 struct ctdb_client_context
*client
,
567 int destnode
, struct timeval timeout
,
570 int ctdb_ctrl_register_notify(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
571 struct ctdb_client_context
*client
,
572 int destnode
, struct timeval timeout
,
573 struct ctdb_notify_data
*notify
);
575 int ctdb_ctrl_deregister_notify(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
576 struct ctdb_client_context
*client
,
577 int destnode
, struct timeval timeout
,
580 int ctdb_ctrl_trans3_commit(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
581 struct ctdb_client_context
*client
,
582 int destnode
, struct timeval timeout
,
583 struct ctdb_rec_buffer
*recbuf
);
585 int ctdb_ctrl_get_db_seqnum(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
586 struct ctdb_client_context
*client
,
587 int destnode
, struct timeval timeout
,
588 uint32_t db_id
, uint64_t *seqnum
);
590 int ctdb_ctrl_db_set_healthy(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
591 struct ctdb_client_context
*client
,
592 int destnode
, struct timeval timeout
,
595 int ctdb_ctrl_db_get_health(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
596 struct ctdb_client_context
*client
,
597 int destnode
, struct timeval timeout
,
598 uint32_t db_id
, const char **reason
);
600 int ctdb_ctrl_get_public_ip_info(TALLOC_CTX
*mem_ctx
,
601 struct tevent_context
*ev
,
602 struct ctdb_client_context
*client
,
603 int destnode
, struct timeval timeout
,
604 ctdb_sock_addr
*addr
,
605 struct ctdb_public_ip_info
**ipinfo
);
607 int ctdb_ctrl_get_ifaces(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
608 struct ctdb_client_context
*client
,
609 int destnode
, struct timeval timeout
,
610 struct ctdb_iface_list
**iface_list
);
612 int ctdb_ctrl_set_iface_link_state(TALLOC_CTX
*mem_ctx
,
613 struct tevent_context
*ev
,
614 struct ctdb_client_context
*client
,
615 int destnode
, struct timeval timeout
,
616 struct ctdb_iface
*iface
);
618 int ctdb_ctrl_tcp_add_delayed_update(TALLOC_CTX
*mem_ctx
,
619 struct tevent_context
*ev
,
620 struct ctdb_client_context
*client
,
621 int destnode
, struct timeval timeout
,
622 struct ctdb_connection
*conn
);
624 int ctdb_ctrl_get_stat_history(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
625 struct ctdb_client_context
*client
,
626 int destnode
, struct timeval timeout
,
627 struct ctdb_statistics_list
**stats_list
);
629 int ctdb_ctrl_schedule_for_deletion(TALLOC_CTX
*mem_ctx
,
630 struct tevent_context
*ev
,
631 struct ctdb_client_context
*client
,
632 int destnode
, struct timeval timeout
,
633 struct ctdb_key_data
*key
);
635 int ctdb_ctrl_set_db_readonly(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
636 struct ctdb_client_context
*client
,
637 int destnode
, struct timeval timeout
,
640 int ctdb_ctrl_check_srvids(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
641 struct ctdb_client_context
*client
,
642 int destnode
, struct timeval timeout
,
643 uint64_t *srvid
, int count
, uint8_t **result
);
645 int ctdb_ctrl_traverse_start_ext(TALLOC_CTX
*mem_ctx
,
646 struct tevent_context
*ev
,
647 struct ctdb_client_context
*client
,
648 int destnode
, struct timeval timeout
,
649 struct ctdb_traverse_start_ext
*traverse
);
651 int ctdb_ctrl_get_db_statistics(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
652 struct ctdb_client_context
*client
,
653 int destnode
, struct timeval timeout
,
655 struct ctdb_db_statistics
**dbstats
);
657 int ctdb_ctrl_set_db_sticky(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
658 struct ctdb_client_context
*client
,
659 int destnode
, struct timeval timeout
,
662 int ctdb_ctrl_reload_public_ips(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
663 struct ctdb_client_context
*client
,
664 int destnode
, struct timeval timeout
);
666 int ctdb_ctrl_ipreallocated(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
667 struct ctdb_client_context
*client
,
668 int destnode
, struct timeval timeout
);
670 int ctdb_ctrl_get_runstate(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
671 struct ctdb_client_context
*client
,
672 int destnode
, struct timeval timeout
,
673 enum ctdb_runstate
*runstate
);
675 int ctdb_ctrl_db_detach(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
676 struct ctdb_client_context
*client
,
677 int destnode
, struct timeval timeout
,
680 int ctdb_ctrl_get_nodes_file(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
681 struct ctdb_client_context
*client
,
682 int destnode
, struct timeval timeout
,
683 struct ctdb_node_map
**nodemap
);
685 int ctdb_ctrl_db_freeze(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
686 struct ctdb_client_context
*client
,
687 int destnode
, struct timeval timeout
, uint32_t db_id
);
689 int ctdb_ctrl_db_thaw(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
690 struct ctdb_client_context
*client
,
691 int destnode
, struct timeval timeout
, uint32_t db_id
);
693 int ctdb_ctrl_db_transaction_start(TALLOC_CTX
*mem_ctx
,
694 struct tevent_context
*ev
,
695 struct ctdb_client_context
*client
,
696 int destnode
, struct timeval timeout
,
697 struct ctdb_transdb
*transdb
);
699 int ctdb_ctrl_db_transaction_commit(TALLOC_CTX
*mem_ctx
,
700 struct tevent_context
*ev
,
701 struct ctdb_client_context
*client
,
702 int destnode
, struct timeval timeout
,
703 struct ctdb_transdb
*transdb
);
705 int ctdb_ctrl_db_transaction_cancel(TALLOC_CTX
*mem_ctx
,
706 struct tevent_context
*ev
,
707 struct ctdb_client_context
*client
,
708 int destnode
, struct timeval timeout
,
711 int ctdb_ctrl_db_pull(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
712 struct ctdb_client_context
*client
,
713 int destnode
, struct timeval timeout
,
714 struct ctdb_pulldb_ext
*pulldb
, uint32_t *num_records
);
716 int ctdb_ctrl_db_push_start(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
717 struct ctdb_client_context
*client
,
718 int destnode
, struct timeval timeout
,
719 struct ctdb_pulldb_ext
*pulldb
);
721 int ctdb_ctrl_db_push_confirm(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
722 struct ctdb_client_context
*client
,
723 int destnode
, struct timeval timeout
,
724 uint32_t db_id
, uint32_t *num_records
);
726 /* from client/client_db.c */
728 struct tevent_req
*ctdb_attach_send(TALLOC_CTX
*mem_ctx
,
729 struct tevent_context
*ev
,
730 struct ctdb_client_context
*client
,
731 struct timeval timeout
,
732 const char *db_name
, uint8_t db_flags
);
734 bool ctdb_attach_recv(struct tevent_req
*req
, int *perr
,
735 struct ctdb_db_context
**out
);
737 int ctdb_attach(struct tevent_context
*ev
,
738 struct ctdb_client_context
*client
,
739 struct timeval timeout
,
740 const char *db_name
, uint8_t db_flags
,
741 struct ctdb_db_context
**out
);
743 int ctdb_detach(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
744 struct ctdb_client_context
*client
,
745 struct timeval timeout
, uint32_t db_id
);
747 uint32_t ctdb_db_id(struct ctdb_db_context
*db
);
749 int ctdb_db_traverse(struct ctdb_db_context
*db
, bool readonly
,
751 ctdb_rec_parser_func_t parser
, void *private_data
);
753 struct tevent_req
*ctdb_fetch_lock_send(TALLOC_CTX
*mem_ctx
,
754 struct tevent_context
*ev
,
755 struct ctdb_client_context
*client
,
756 struct ctdb_db_context
*db
,
757 TDB_DATA key
, bool readonly
);
759 struct ctdb_record_handle
*ctdb_fetch_lock_recv(struct tevent_req
*req
,
760 struct ctdb_ltdb_header
*header
,
762 TDB_DATA
*data
, int *perr
);
764 int ctdb_fetch_lock(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
765 struct ctdb_client_context
*client
,
766 struct ctdb_db_context
*db
, TDB_DATA key
, bool readonly
,
767 struct ctdb_record_handle
**out
,
768 struct ctdb_ltdb_header
*header
, TDB_DATA
*data
);
770 int ctdb_store_record(struct ctdb_record_handle
*h
, TDB_DATA data
);
772 int ctdb_delete_record(struct ctdb_record_handle
*h
);
774 struct tevent_req
*ctdb_g_lock_lock_send(TALLOC_CTX
*mem_ctx
,
775 struct tevent_context
*ev
,
776 struct ctdb_client_context
*client
,
777 struct ctdb_db_context
*db
,
779 struct ctdb_server_id
*sid
,
782 bool ctdb_g_lock_lock_recv(struct tevent_req
*req
, int *perr
);
784 struct tevent_req
*ctdb_g_lock_unlock_send(TALLOC_CTX
*mem_ctx
,
785 struct tevent_context
*ev
,
786 struct ctdb_client_context
*client
,
787 struct ctdb_db_context
*db
,
789 struct ctdb_server_id sid
);
791 bool ctdb_g_lock_unlock_recv(struct tevent_req
*req
, int *perr
);
793 struct tevent_req
*ctdb_transaction_start_send(TALLOC_CTX
*mem_ctx
,
794 struct tevent_context
*ev
,
795 struct ctdb_client_context
*client
,
796 struct timeval timeout
,
797 struct ctdb_db_context
*db
,
800 struct ctdb_transaction_handle
*ctdb_transaction_start_recv(
801 struct tevent_req
*req
,
804 int ctdb_transaction_start(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
805 struct ctdb_client_context
*client
,
806 struct timeval timeout
,
807 struct ctdb_db_context
*db
, bool readonly
,
808 struct ctdb_transaction_handle
**out
);
810 int ctdb_transaction_fetch_record(struct ctdb_transaction_handle
*h
,
812 TALLOC_CTX
*mem_ctx
, TDB_DATA
*data
);
814 int ctdb_transaction_store_record(struct ctdb_transaction_handle
*h
,
815 TDB_DATA key
, TDB_DATA data
);
817 int ctdb_transaction_delete_record(struct ctdb_transaction_handle
*h
,
820 struct tevent_req
*ctdb_transaction_commit_send(
822 struct tevent_context
*ev
,
823 struct ctdb_transaction_handle
*h
);
825 bool ctdb_transaction_commit_recv(struct tevent_req
*req
, int *perr
);
827 int ctdb_transaction_commit(struct ctdb_transaction_handle
*h
);
829 int ctdb_transaction_cancel(struct ctdb_transaction_handle
*h
);
831 /* from client/client_util.c */
833 int list_of_nodes(struct ctdb_node_map
*nodemap
,
834 uint32_t flags_mask
, uint32_t exclude_pnn
,
835 TALLOC_CTX
*mem_ctx
, uint32_t **pnn_list
);
837 int list_of_active_nodes(struct ctdb_node_map
*nodemap
, uint32_t exclude_pnn
,
838 TALLOC_CTX
*mem_ctx
, uint32_t **pnn_list
);
840 int list_of_connected_nodes(struct ctdb_node_map
*nodemap
,
841 uint32_t exclude_pnn
,
842 TALLOC_CTX
*mem_ctx
, uint32_t **pnn_list
);
844 int ctdb_ctrl_modflags(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
845 struct ctdb_client_context
*client
,
846 uint32_t destnode
, struct timeval timeout
,
847 uint32_t set
, uint32_t clear
);
849 bool ctdb_server_id_equal(struct ctdb_server_id
*sid1
,
850 struct ctdb_server_id
*sid2
);
852 int ctdb_server_id_exists(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
853 struct ctdb_client_context
*client
,
854 struct ctdb_server_id
*sid
, bool *exists
);
856 #endif /* __CTDB_CLIENT_H__ */