ctdb-ipalloc: Use a cumulative timeout for takeover run stages
[Samba.git] / ctdb / include / ctdb_client.h
blobe81d7bb6615c98d43f592cbedc8415cf30118df0
1 /*
2 ctdb database library: old client interface
4 Copyright (C) Andrew Tridgell 2006
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
23 #include "common/srvid.h"
24 #include "ctdb_protocol.h"
26 enum control_state {
27 CTDB_CONTROL_WAIT,
28 CTDB_CONTROL_DONE,
29 CTDB_CONTROL_ERROR,
30 CTDB_CONTROL_TIMEOUT
33 struct ctdb_client_control_state {
34 struct ctdb_context *ctdb;
35 uint32_t reqid;
36 int32_t status;
37 TDB_DATA outdata;
38 enum control_state state;
39 char *errormsg;
40 struct ctdb_req_control_old *c;
42 /* if we have a callback registered for the completion (or failure) of
43 this control
44 if a callback is used, it MUST talloc_free the cb_data passed to it
46 struct {
47 void (*fn)(struct ctdb_client_control_state *);
48 void *private_data;
49 } async;
52 struct tevent_context;
53 struct ctdb_db_context;
56 allocate a packet for use in client<->daemon communication
58 struct ctdb_req_header *_ctdbd_allocate_pkt(struct ctdb_context *ctdb,
59 TALLOC_CTX *mem_ctx,
60 enum ctdb_operation operation,
61 size_t length, size_t slength,
62 const char *type);
64 #define ctdbd_allocate_pkt(ctdb, mem_ctx, operation, length, type) \
65 (type *)_ctdbd_allocate_pkt(ctdb, mem_ctx, operation, length, \
66 sizeof(type), #type)
68 int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
69 struct ctdb_ltdb_header *header, TALLOC_CTX *mem_ctx,
70 TDB_DATA *data, bool updatetdb);
72 void ctdb_request_message(struct ctdb_context *ctdb,
73 struct ctdb_req_header *hdr);
75 void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args);
77 int ctdb_socket_connect(struct ctdb_context *ctdb);
80 make a ctdb call. The associated ctdb call function will be called on the DMASTER
81 for the given record
83 struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db,
84 struct ctdb_call *call);
85 int ctdb_call_recv(struct ctdb_client_call_state *state,
86 struct ctdb_call *call);
87 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
89 /* setup a handler for ctdb messages */
90 typedef void (*ctdb_msg_fn_t)(struct ctdb_context *, uint64_t srvid,
91 TDB_DATA data, void *);
93 int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
94 srvid_handler_fn handler,
95 void *private_data);
96 int ctdb_client_remove_message_handler(struct ctdb_context *ctdb,
97 uint64_t srvid, void *private_data);
98 int ctdb_client_check_message_handlers(struct ctdb_context *ctdb,
99 uint64_t *ids, uint32_t num,
100 uint8_t *result);
102 /* send a ctdb message */
103 int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t pnn,
104 uint64_t srvid, TDB_DATA data);
107 Fetch a ctdb record from a remote node. Underneath this will force the
108 dmaster for the record to be moved to the local node.
110 struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db,
111 TALLOC_CTX *mem_ctx,
112 TDB_DATA key, TDB_DATA *data);
114 struct ctdb_record_handle *ctdb_fetch_readonly_lock(
115 struct ctdb_db_context *ctdb_db,
116 TALLOC_CTX *mem_ctx, TDB_DATA key,
117 TDB_DATA *data, int read_only);
119 int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
121 int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
122 TDB_DATA key, TDB_DATA *data);
124 struct ctdb_client_control_state *ctdb_control_send(struct ctdb_context *ctdb,
125 uint32_t destnode,
126 uint64_t srvid,
127 uint32_t opcode,
128 uint32_t flags,
129 TDB_DATA data,
130 TALLOC_CTX *mem_ctx,
131 struct timeval *timeout,
132 char **errormsg);
133 int ctdb_control_recv(struct ctdb_context *ctdb,
134 struct ctdb_client_control_state *state,
135 TALLOC_CTX *mem_ctx, TDB_DATA *outdata,
136 int32_t *status, char **errormsg);
137 int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint64_t srvid,
138 uint32_t opcode, uint32_t flags, TDB_DATA data,
139 TALLOC_CTX *mem_ctx, TDB_DATA *outdata, int32_t *status,
140 struct timeval *timeout, char **errormsg);
142 int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode,
143 pid_t pid);
145 int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode,
146 struct ctdb_statistics *status);
147 int ctdb_ctrl_dbstatistics(struct ctdb_context *ctdb, uint32_t destnode,
148 uint32_t dbid, TALLOC_CTX *mem_ctx,
149 struct ctdb_db_statistics_old **dbstat);
151 int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout,
152 uint32_t destnode);
154 int ctdb_ctrl_getvnnmap(struct ctdb_context *ctdb, struct timeval timeout,
155 uint32_t destnode, TALLOC_CTX *mem_ctx,
156 struct ctdb_vnn_map **vnnmap);
157 int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb, struct timeval timeout,
158 uint32_t destnode, TALLOC_CTX *mem_ctx,
159 struct ctdb_vnn_map *vnnmap);
162 get the recovery mode of a remote node
164 struct ctdb_client_control_state *ctdb_ctrl_getrecmode_send(
165 struct ctdb_context *ctdb,
166 TALLOC_CTX *mem_ctx,
167 struct timeval timeout,
168 uint32_t destnode);
169 int ctdb_ctrl_getrecmode_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
170 struct ctdb_client_control_state *state,
171 uint32_t *recmode);
172 int ctdb_ctrl_getrecmode(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
173 struct timeval timeout, uint32_t destnode,
174 uint32_t *recmode);
177 set the recovery mode of a remote node
179 int ctdb_ctrl_setrecmode(struct ctdb_context *ctdb, struct timeval timeout,
180 uint32_t destnode, uint32_t recmode);
183 get the recovery master of a remote node
185 struct ctdb_client_control_state *ctdb_ctrl_getrecmaster_send(
186 struct ctdb_context *ctdb,
187 TALLOC_CTX *mem_ctx,
188 struct timeval timeout,
189 uint32_t destnode);
190 int ctdb_ctrl_getrecmaster_recv(struct ctdb_context *ctdb,
191 TALLOC_CTX *mem_ctx,
192 struct ctdb_client_control_state *state,
193 uint32_t *recmaster);
194 int ctdb_ctrl_getrecmaster(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
195 struct timeval timeout, uint32_t destnode,
196 uint32_t *recmaster);
199 set the recovery master of a remote node
201 int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout,
202 uint32_t destnode, uint32_t recmaster);
204 int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout,
205 uint32_t destnode, TALLOC_CTX *mem_ctx,
206 struct ctdb_dbid_map_old **dbmap);
208 int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb, struct timeval timeout,
209 uint32_t destnode, TALLOC_CTX *mem_ctx,
210 struct ctdb_node_map_old **nodemap);
212 int ctdb_ctrl_getnodesfile(struct ctdb_context *ctdb, struct timeval timeout,
213 uint32_t destnode, TALLOC_CTX *mem_ctx,
214 struct ctdb_node_map_old **nodemap);
216 int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb,
217 struct timeval timeout, uint32_t destnode);
219 struct ctdb_client_control_state *ctdb_ctrl_pulldb_send(
220 struct ctdb_context *ctdb,
221 uint32_t destnode, uint32_t dbid,
222 uint32_t lmaster, TALLOC_CTX *mem_ctx,
223 struct timeval timeout);
224 int ctdb_ctrl_pulldb_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
225 struct ctdb_client_control_state *state,
226 TDB_DATA *outdata);
227 int ctdb_ctrl_pulldb(struct ctdb_context *ctdb, uint32_t destnode,
228 uint32_t dbid, uint32_t lmaster, TALLOC_CTX *mem_ctx,
229 struct timeval timeout, TDB_DATA *outdata);
232 change dmaster for all keys in the database to the new value
234 int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb, struct timeval timeout,
235 uint32_t destnode, TALLOC_CTX *mem_ctx,
236 uint32_t dbid, uint32_t dmaster);
238 int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode);
240 int ctdb_ctrl_get_runstate(struct ctdb_context *ctdb, struct timeval timeout,
241 uint32_t destnode, uint32_t *runstate);
243 int ctdb_ctrl_getdbpath(struct ctdb_context *ctdb, struct timeval timeout,
244 uint32_t destnode, uint32_t dbid,
245 TALLOC_CTX *mem_ctx, const char **path);
246 int ctdb_ctrl_getdbname(struct ctdb_context *ctdb, struct timeval timeout,
247 uint32_t destnode, uint32_t dbid,
248 TALLOC_CTX *mem_ctx, const char **name);
249 int ctdb_ctrl_getdbhealth(struct ctdb_context *ctdb, struct timeval timeout,
250 uint32_t destnode, uint32_t dbid,
251 TALLOC_CTX *mem_ctx, const char **reason);
252 int ctdb_ctrl_getdbseqnum(struct ctdb_context *ctdb, struct timeval timeout,
253 uint32_t destnode, uint32_t dbid, uint64_t *seqnum);
255 int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout,
256 uint32_t destnode, TALLOC_CTX *mem_ctx,
257 const char *name, bool persistent);
259 int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode,
260 int32_t *level);
261 int ctdb_ctrl_set_debuglevel(struct ctdb_context *ctdb, uint32_t destnode,
262 int32_t level);
264 uint32_t *ctdb_get_connected_nodes(struct ctdb_context *ctdb,
265 struct timeval timeout,
266 TALLOC_CTX *mem_ctx, uint32_t *num_nodes);
268 int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode);
271 attach to a ctdb database
273 struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
274 struct timeval timeout,
275 const char *name,
276 bool persistent,
277 uint32_t tdb_flags);
279 int ctdb_detach(struct ctdb_context *ctdb, uint32_t db_id);
281 /* a ctdb call function */
282 typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
285 setup a ctdb call function
287 int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id);
290 typedef int (*ctdb_traverse_func)(TDB_DATA, TDB_DATA, void *);
292 int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn,
293 void *private_data);
295 struct ctdb_dump_db_context {
296 struct ctdb_context *ctdb;
297 FILE *f;
298 bool printemptyrecords;
299 bool printdatasize;
300 bool printlmaster;
301 bool printhash;
302 bool printrecordflags;
305 int ctdb_dumpdb_record(TDB_DATA key, TDB_DATA data, void *p);
306 int ctdb_dump_db(struct ctdb_db_context *ctdb_db,
307 struct ctdb_dump_db_context *ctx);
310 get the pid of a ctdb daemon
312 int ctdb_ctrl_getpid(struct ctdb_context *ctdb, struct timeval timeout,
313 uint32_t destnode, uint32_t *pid);
315 struct ctdb_client_control_state *ctdb_ctrl_freeze_send(
316 struct ctdb_context *ctdb,
317 TALLOC_CTX *mem_ctx,
318 struct timeval timeout,
319 uint32_t destnode, uint32_t priority);
320 int ctdb_ctrl_freeze_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
321 struct ctdb_client_control_state *state);
323 int ctdb_ctrl_freeze_priority(struct ctdb_context *ctdb, struct timeval timeout,
324 uint32_t destnode, uint32_t priority);
325 int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout,
326 uint32_t destnode);
328 int ctdb_ctrl_thaw_priority(struct ctdb_context *ctdb, struct timeval timeout,
329 uint32_t destnode, uint32_t priority);
330 int ctdb_ctrl_thaw(struct ctdb_context *ctdb, struct timeval timeout,
331 uint32_t destnode);
333 int ctdb_ctrl_getpnn(struct ctdb_context *ctdb, struct timeval timeout,
334 uint32_t destnode);
337 get the monitoring mode of a remote node
339 int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout,
340 uint32_t destnode, uint32_t *monmode);
343 set the monitoring mode of a remote node to active
345 int ctdb_ctrl_enable_monmode(struct ctdb_context *ctdb,
346 struct timeval timeout, uint32_t destnode);
349 set the monitoring mode of a remote node to disabled
351 int ctdb_ctrl_disable_monmode(struct ctdb_context *ctdb,
352 struct timeval timeout, uint32_t destnode);
354 int ctdb_ctrl_takeover_ip(struct ctdb_context *ctdb, struct timeval timeout,
355 uint32_t destnode, struct ctdb_public_ip *ip);
356 int ctdb_ctrl_release_ip(struct ctdb_context *ctdb, struct timeval timeout,
357 uint32_t destnode, struct ctdb_public_ip *ip);
359 int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb,
360 struct timeval timeout, uint32_t destnode,
361 const char *name, uint32_t *value);
362 int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb,
363 struct timeval timeout, uint32_t destnode,
364 const char *name, uint32_t value);
365 int ctdb_ctrl_list_tunables(struct ctdb_context *ctdb,
366 struct timeval timeout, uint32_t destnode,
367 TALLOC_CTX *mem_ctx,
368 const char ***list, uint32_t *count);
370 int ctdb_ctrl_get_public_ips_flags(struct ctdb_context *ctdb,
371 struct timeval timeout, uint32_t destnode,
372 TALLOC_CTX *mem_ctx, uint32_t flags,
373 struct ctdb_public_ip_list_old **ips);
374 int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
375 struct timeval timeout, uint32_t destnode,
376 TALLOC_CTX *mem_ctx,
377 struct ctdb_public_ip_list_old **ips);
378 int ctdb_ctrl_get_public_ip_info(struct ctdb_context *ctdb,
379 struct timeval timeout, uint32_t destnode,
380 TALLOC_CTX *mem_ctx,
381 const ctdb_sock_addr *addr,
382 struct ctdb_public_ip_info_old **info);
384 int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
385 struct timeval timeout, uint32_t destnode,
386 TALLOC_CTX *mem_ctx,
387 struct ctdb_iface_list_old **ifaces);
388 int ctdb_ctrl_set_iface_link(struct ctdb_context *ctdb,
389 struct timeval timeout, uint32_t destnode,
390 TALLOC_CTX *mem_ctx,
391 const struct ctdb_iface *info);
393 int ctdb_ctrl_modflags(struct ctdb_context *ctdb,
394 struct timeval timeout,
395 uint32_t destnode,
396 uint32_t set, uint32_t clear);
398 int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
399 struct timeval timeout, uint32_t destnode,
400 struct ctdb_tunable_list *tunables);
402 int ctdb_ctrl_add_public_ip(struct ctdb_context *ctdb,
403 struct timeval timeout, uint32_t destnode,
404 struct ctdb_addr_info_old *pub);
405 int ctdb_ctrl_del_public_ip(struct ctdb_context *ctdb,
406 struct timeval timeout, uint32_t destnode,
407 struct ctdb_addr_info_old *pub);
409 int ctdb_ctrl_killtcp(struct ctdb_context *ctdb,
410 struct timeval timeout, uint32_t destnode,
411 struct ctdb_connection *killtcp);
413 int ctdb_ctrl_gratious_arp(struct ctdb_context *ctdb,
414 struct timeval timeout, uint32_t destnode,
415 ctdb_sock_addr *addr, const char *ifname);
417 int ctdb_ctrl_get_tcp_tickles(struct ctdb_context *ctdb,
418 struct timeval timeout, uint32_t destnode,
419 TALLOC_CTX *mem_ctx, ctdb_sock_addr *addr,
420 struct ctdb_tickle_list_old **list);
422 int ctdb_ctrl_register_server_id(struct ctdb_context *ctdb,
423 struct timeval timeout,
424 struct ctdb_client_id *id);
425 int ctdb_ctrl_unregister_server_id(struct ctdb_context *ctdb,
426 struct timeval timeout,
427 struct ctdb_client_id *id);
428 int ctdb_ctrl_check_server_id(struct ctdb_context *ctdb,
429 struct timeval timeout, uint32_t destnode,
430 struct ctdb_client_id *id, uint32_t *status);
431 int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
432 TALLOC_CTX *mem_ctx,
433 struct timeval timeout, uint32_t destnode,
434 struct ctdb_client_id_list_old **svid_list);
437 initialise ctdb subsystem
439 struct ctdb_context *ctdb_init(struct tevent_context *ev);
442 set some flags
444 void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags);
446 int ctdb_set_socketname(struct ctdb_context *ctdb, const char *socketname);
447 const char *ctdb_get_socketname(struct ctdb_context *ctdb);
449 /* return pnn of this node */
450 uint32_t ctdb_get_pnn(struct ctdb_context *ctdb);
453 get the uptime of a remote node
455 struct ctdb_client_control_state *ctdb_ctrl_uptime_send(
456 struct ctdb_context *ctdb,
457 TALLOC_CTX *mem_ctx,
458 struct timeval timeout,
459 uint32_t destnode);
460 int ctdb_ctrl_uptime_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
461 struct ctdb_client_control_state *state,
462 struct ctdb_uptime **uptime);
463 int ctdb_ctrl_uptime(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
464 struct timeval timeout, uint32_t destnode,
465 struct ctdb_uptime **uptime);
467 int ctdb_ctrl_end_recovery(struct ctdb_context *ctdb, struct timeval timeout,
468 uint32_t destnode);
470 typedef void (*client_async_callback)(struct ctdb_context *ctdb,
471 uint32_t node_pnn, int32_t res,
472 TDB_DATA outdata, void *callback_data);
474 struct client_async_data {
475 enum ctdb_controls opcode;
476 bool dont_log_errors;
477 uint32_t count;
478 uint32_t fail_count;
479 client_async_callback callback;
480 client_async_callback fail_callback;
481 void *callback_data;
484 void ctdb_client_async_add(struct client_async_data *data,
485 struct ctdb_client_control_state *state);
486 int ctdb_client_async_wait(struct ctdb_context *ctdb,
487 struct client_async_data *data);
488 int ctdb_client_async_control(struct ctdb_context *ctdb,
489 enum ctdb_controls opcode, uint32_t *nodes,
490 uint64_t srvid, struct timeval timeout,
491 bool dont_log_errors, TDB_DATA data,
492 client_async_callback client_callback,
493 client_async_callback fail_callback,
494 void *callback_data);
496 uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
497 struct ctdb_vnn_map *vnn_map,
498 TALLOC_CTX *mem_ctx, bool include_self);
500 uint32_t *list_of_nodes(struct ctdb_context *ctdb,
501 struct ctdb_node_map_old *node_map,
502 TALLOC_CTX *mem_ctx, uint32_t mask, int exclude_pnn);
503 uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
504 struct ctdb_node_map_old *node_map,
505 TALLOC_CTX *mem_ctx, bool include_self);
506 uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
507 struct ctdb_node_map_old *node_map,
508 TALLOC_CTX *mem_ctx, bool include_self);
510 int ctdb_read_pnn_lock(int fd, int32_t pnn);
513 get capabilities of a remote node
516 struct ctdb_client_control_state *ctdb_ctrl_getcapabilities_send(
517 struct ctdb_context *ctdb,
518 TALLOC_CTX *mem_ctx,
519 struct timeval timeout,
520 uint32_t destnode);
521 int ctdb_ctrl_getcapabilities_recv(struct ctdb_context *ctdb,
522 TALLOC_CTX *mem_ctx,
523 struct ctdb_client_control_state *state,
524 uint32_t *capabilities);
525 int ctdb_ctrl_getcapabilities(struct ctdb_context *ctdb,
526 struct timeval timeout, uint32_t destnode,
527 uint32_t *capabilities);
529 struct ctdb_node_capabilities {
530 bool retrieved;
531 uint32_t capabilities;
534 /* Retrieve capabilities for all connected nodes. The length of the
535 * returned array can be calculated using talloc_array_length(). */
536 struct ctdb_node_capabilities *ctdb_get_capabilities(
537 struct ctdb_context *ctdb,
538 TALLOC_CTX *mem_ctx,
539 struct timeval timeout,
540 struct ctdb_node_map_old *nodemap);
542 /* Get capabilities for specified node, NULL if not found */
543 uint32_t *ctdb_get_node_capabilities(struct ctdb_node_capabilities *caps,
544 uint32_t pnn);
546 /* True if the given node has all of the required capabilities */
547 bool ctdb_node_has_capabilities(struct ctdb_node_capabilities *caps,
548 uint32_t pnn, uint32_t capabilities_required);
551 struct ctdb_transaction_handle *ctdb_transaction_start(
552 struct ctdb_db_context *ctdb_db,
553 TALLOC_CTX *mem_ctx);
554 int ctdb_transaction_fetch(struct ctdb_transaction_handle *h,
555 TALLOC_CTX *mem_ctx,
556 TDB_DATA key, TDB_DATA *data);
557 int ctdb_transaction_store(struct ctdb_transaction_handle *h,
558 TDB_DATA key, TDB_DATA data);
559 int ctdb_transaction_commit(struct ctdb_transaction_handle *h);
560 int ctdb_transaction_cancel(struct ctdb_transaction_handle *h);
562 int ctdb_ctrl_recd_ping(struct ctdb_context *ctdb);
564 int ctdb_ctrl_getscriptstatus(struct ctdb_context *ctdb,
565 struct timeval timeout, uint32_t destnode,
566 TALLOC_CTX *mem_ctx,
567 enum ctdb_event type,
568 struct ctdb_script_list_old **script_status);
570 int ctdb_ctrl_report_recd_lock_latency(struct ctdb_context *ctdb,
571 struct timeval timeout, double latency);
573 int ctdb_ctrl_getreclock(struct ctdb_context *ctdb,
574 struct timeval timeout, uint32_t destnode,
575 TALLOC_CTX *mem_ctx, const char **reclock);
576 int ctdb_ctrl_setreclock(struct ctdb_context *ctdb,
577 struct timeval timeout, uint32_t destnode,
578 const char *reclock);
580 int ctdb_ctrl_stop_node(struct ctdb_context *ctdb, struct timeval timeout,
581 uint32_t destnode);
582 int ctdb_ctrl_continue_node(struct ctdb_context *ctdb, struct timeval timeout,
583 uint32_t destnode);
585 int ctdb_ctrl_setnatgwstate(struct ctdb_context *ctdb,
586 struct timeval timeout, uint32_t destnode,
587 uint32_t natgwstate);
588 int ctdb_ctrl_setlmasterrole(struct ctdb_context *ctdb,
589 struct timeval timeout, uint32_t destnode,
590 uint32_t lmasterrole);
591 int ctdb_ctrl_setrecmasterrole(struct ctdb_context *ctdb,
592 struct timeval timeout, uint32_t destnode,
593 uint32_t recmasterrole);
595 int ctdb_ctrl_enablescript(struct ctdb_context *ctdb, struct timeval timeout,
596 uint32_t destnode, const char *script);
597 int ctdb_ctrl_disablescript(struct ctdb_context *ctdb, struct timeval timeout,
598 uint32_t destnode, const char *script);
600 int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout,
601 uint32_t destnode, struct ctdb_ban_state *bantime);
602 int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout,
603 uint32_t destnode, TALLOC_CTX *mem_ctx,
604 struct ctdb_ban_state **bantime);
606 int ctdb_ctrl_set_db_priority(struct ctdb_context *ctdb,
607 struct timeval timeout, uint32_t destnode,
608 struct ctdb_db_priority *db_prio);
609 int ctdb_ctrl_get_db_priority(struct ctdb_context *ctdb,
610 struct timeval timeout, uint32_t destnode,
611 uint32_t db_id, uint32_t *priority);
613 int ctdb_ctrl_getstathistory(struct ctdb_context *ctdb,
614 struct timeval timeout, uint32_t destnode,
615 TALLOC_CTX *mem_ctx,
616 struct ctdb_statistics_list_old **stats);
618 struct ctdb_ltdb_header *ctdb_header_from_record_handle(
619 struct ctdb_record_handle *h);
621 struct ctdb_client_control_state *ctdb_ctrl_updaterecord_send(
622 struct ctdb_context *ctdb,
623 TALLOC_CTX *mem_ctx,
624 struct timeval timeout,
625 uint32_t destnode,
626 struct ctdb_db_context *ctdb_db,
627 TDB_DATA key,
628 struct ctdb_ltdb_header *header,
629 TDB_DATA data);
630 int ctdb_ctrl_updaterecord_recv(struct ctdb_context *ctdb,
631 struct ctdb_client_control_state *state);
632 int ctdb_ctrl_updaterecord(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
633 struct timeval timeout, uint32_t destnode,
634 struct ctdb_db_context *ctdb_db, TDB_DATA key,
635 struct ctdb_ltdb_header *header, TDB_DATA data);
637 struct ctdb_client_control_state *ctdb_ctrl_set_db_readonly_send(
638 struct ctdb_context *ctdb,
639 uint32_t destnode, uint32_t dbid);
640 int ctdb_ctrl_set_db_readonly_recv(struct ctdb_context *ctdb,
641 struct ctdb_client_control_state *state);
642 int ctdb_ctrl_set_db_readonly(struct ctdb_context *ctdb, uint32_t destnode,
643 uint32_t dbid);
645 struct ctdb_client_control_state *ctdb_ctrl_set_db_sticky_send(
646 struct ctdb_context *ctdb,
647 uint32_t destnode, uint32_t dbid);
648 int ctdb_ctrl_set_db_sticky_recv(struct ctdb_context *ctdb,
649 struct ctdb_client_control_state *state);
650 int ctdb_ctrl_set_db_sticky(struct ctdb_context *ctdb, uint32_t destnode,
651 uint32_t dbid);
653 #endif /* _CTDB_CLIENT_H */