Merge commit 'rusty/ports-from-1.0.112' into foo
[metze/ctdb/wip.git] / include / ctdb_client.h
1 /*
2    ctdb database library: old client interface
3
4    Copyright (C) Andrew Tridgell  2006
5
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.
10
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.
15
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/>.
18 */
19
20 #ifndef _CTDB_CLIENT_H
21 #define _CTDB_CLIENT_H
22 #include <ctdb_protocol.h>
23
24 enum control_state {CTDB_CONTROL_WAIT, CTDB_CONTROL_DONE, CTDB_CONTROL_ERROR, CTDB_CONTROL_TIMEOUT};
25
26 struct ctdb_client_control_state {
27         struct ctdb_context *ctdb;
28         uint32_t reqid;
29         int32_t status;
30         TDB_DATA outdata;
31         enum control_state state;
32         char *errormsg;
33         struct ctdb_req_control *c;
34
35         /* if we have a callback registered for the completion (or failure) of
36            this control
37            if a callback is used, it MUST talloc_free the cb_data passed to it
38         */
39         struct {
40                 void (*fn)(struct ctdb_client_control_state *);
41                 void *private_data;
42         } async;
43 };
44
45 struct ctdb_client_notify_register {
46         uint64_t srvid;
47         uint32_t len;
48         uint8_t notify_data[1];
49 };
50
51 struct ctdb_client_notify_deregister {
52         uint64_t srvid;
53 };
54
55 struct tevent_context;
56
57 /*
58   initialise ctdb subsystem
59 */
60 struct ctdb_context *ctdb_init(struct tevent_context *ev);
61
62 /*
63   choose the transport
64 */
65 int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport);
66
67 /*
68   set the directory for the local databases
69 */
70 int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir);
71 int ctdb_set_tdb_dir_persistent(struct ctdb_context *ctdb, const char *dir);
72 int ctdb_set_tdb_dir_state(struct ctdb_context *ctdb, const char *dir);
73
74 /*
75   set some flags
76 */
77 void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags);
78
79 /*
80   set max acess count before a dmaster migration
81 */
82 void ctdb_set_max_lacount(struct ctdb_context *ctdb, unsigned count);
83
84 /*
85   tell ctdb what address to listen on, in transport specific format
86 */
87 int ctdb_set_address(struct ctdb_context *ctdb, const char *address);
88
89 int ctdb_set_socketname(struct ctdb_context *ctdb, const char *socketname);
90 const char *ctdb_get_socketname(struct ctdb_context *ctdb);
91
92 /*
93   tell ctdb what nodes are available. This takes a filename, which will contain
94   1 node address per line, in a transport specific format
95 */
96 int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist);
97
98 /*
99   Check that a specific ip address exists in the node list and returns
100   the id for the node or -1
101 */
102 int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const char *nodeip);
103
104 /*
105   start the ctdb protocol
106 */
107 int ctdb_start(struct ctdb_context *ctdb);
108 int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog);
109
110 /*
111   attach to a ctdb database
112 */
113 struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent, uint32_t tdb_flags);
114
115 /*
116   find an attached ctdb_db handle given a name
117  */
118 struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, const char *name);
119
120 /*
121   error string for last ctdb error
122 */
123 const char *ctdb_errstr(struct ctdb_context *);
124
125 /* a ctdb call function */
126 typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
127
128 /*
129   setup a ctdb call function
130 */
131 int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id);
132
133
134
135 /*
136   make a ctdb call. The associated ctdb call function will be called on the DMASTER
137   for the given record
138 */
139 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
140
141 /*
142   initiate an ordered ctdb cluster shutdown
143   this function will never return
144 */
145 void ctdb_shutdown(struct ctdb_context *ctdb);
146
147 /* return pnn of this node */
148 uint32_t ctdb_get_pnn(struct ctdb_context *ctdb);
149
150 /*
151   return the number of nodes
152 */
153 uint32_t ctdb_get_num_nodes(struct ctdb_context *ctdb);
154
155 /* setup a handler for ctdb messages */
156 typedef void (*ctdb_msg_fn_t)(struct ctdb_context *, uint64_t srvid,
157                                   TDB_DATA data, void *);
158 int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
159                              ctdb_msg_fn_t handler,
160                              void *private_data);
161 int ctdb_client_remove_message_handler(struct ctdb_context *ctdb,
162                                        uint64_t srvid, void *private_data);
163
164
165 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
166 struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
167 int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call);
168
169 /* send a ctdb message */
170 int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t pnn,
171                       uint64_t srvid, TDB_DATA data);
172
173
174 /*
175    Fetch a ctdb record from a remote node
176  . Underneath this will force the
177    dmaster for the record to be moved to the local node.
178 */
179 struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
180                                            TDB_DATA key, TDB_DATA *data);
181
182 int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
183
184 int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
185                TDB_DATA key, TDB_DATA *data);
186
187 int ctdb_register_message_handler(struct ctdb_context *ctdb,
188                                   TALLOC_CTX *mem_ctx,
189                                   uint64_t srvid,
190                                   ctdb_msg_fn_t handler,
191                                   void *private_data);
192
193 struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id);
194
195
196 struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev);
197
198 struct ctdb_statistics;
199 int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status);
200
201 int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
202
203 struct ctdb_vnn_map;
204 int ctdb_ctrl_getvnnmap(struct ctdb_context *ctdb,
205                 struct timeval timeout, uint32_t destnode,
206                 TALLOC_CTX *mem_ctx, struct ctdb_vnn_map **vnnmap);
207 int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb,
208                 struct timeval timeout, uint32_t destnode,
209                 TALLOC_CTX *mem_ctx, struct ctdb_vnn_map *vnnmap);
210
211 /* table that contains a list of all dbids on a node
212  */
213 struct ctdb_dbid_map {
214         uint32_t num;
215         struct ctdb_dbid {
216                 uint32_t dbid;
217                 bool persistent;
218         } dbs[1];
219 };
220 int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb,
221         struct timeval timeout, uint32_t destnode,
222         TALLOC_CTX *mem_ctx, struct ctdb_dbid_map **dbmap);
223
224
225 struct ctdb_node_map;
226
227 int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
228                     struct timeval timeout, uint32_t destnode,
229                     TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
230
231 int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb,
232                     struct timeval timeout, uint32_t destnode,
233                     TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
234
235 int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb,
236                     struct timeval timeout, uint32_t destnode);
237
238 struct ctdb_key_list {
239         uint32_t dbid;
240         uint32_t num;
241         TDB_DATA *keys;
242         struct ctdb_ltdb_header *headers;
243         TDB_DATA *data;
244 };
245
246 int ctdb_ctrl_pulldb(
247        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
248        uint32_t lmaster, TALLOC_CTX *mem_ctx,
249        struct timeval timeout, TDB_DATA *outdata);
250
251 struct ctdb_client_control_state *ctdb_ctrl_pulldb_send(
252        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
253        uint32_t lmaster, TALLOC_CTX *mem_ctx, struct timeval timeout);
254
255 int ctdb_ctrl_pulldb_recv(
256        struct ctdb_context *ctdb,
257        TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state,
258        TDB_DATA *outdata);
259
260 int ctdb_ctrl_pushdb(
261        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
262        TALLOC_CTX *mem_ctx,
263        struct timeval timeout, TDB_DATA indata);
264
265 struct ctdb_client_control_state *ctdb_ctrl_pushdb_send(
266        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
267        TALLOC_CTX *mem_ctx, struct timeval timeout,
268        TDB_DATA indata);
269
270 int ctdb_ctrl_pushdb_recv(
271        struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
272        struct ctdb_client_control_state *state);
273
274
275 int ctdb_ctrl_copydb(struct ctdb_context *ctdb,
276         struct timeval timeout, uint32_t sourcenode,
277         uint32_t destnode, uint32_t dbid, uint32_t lmaster,
278         TALLOC_CTX *mem_ctx);
279
280 int ctdb_ctrl_getdbpath(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx, const char **path);
281 int ctdb_ctrl_getdbname(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx, const char **name);
282 int ctdb_ctrl_getdbhealth(struct ctdb_context *ctdb,
283                           struct timeval timeout,
284                           uint32_t destnode,
285                           uint32_t dbid, TALLOC_CTX *mem_ctx,
286                           const char **reason);
287 int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, const char *name, bool persistent);
288
289 int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode, pid_t pid);
290
291 int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode);
292
293 int ctdb_ctrl_get_config(struct ctdb_context *ctdb);
294
295 int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t *level);
296 int ctdb_ctrl_set_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t level);
297
298 /*
299   change dmaster for all keys in the database to the new value
300  */
301 int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb,
302         struct timeval timeout, uint32_t destnode,
303         TALLOC_CTX *mem_ctx, uint32_t dbid, uint32_t dmaster);
304
305 /*
306   write a record on a specific db (this implicitely updates dmaster of the record to locally be the vnn of the node where the control is executed on)
307  */
308 int ctdb_ctrl_write_record(struct ctdb_context *ctdb, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid, TDB_DATA key, TDB_DATA data);
309
310 #define CTDB_RECOVERY_NORMAL            0
311 #define CTDB_RECOVERY_ACTIVE            1
312
313 /*
314   get the recovery mode of a remote node
315  */
316 int ctdb_ctrl_getrecmode(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, uint32_t *recmode);
317
318 struct ctdb_client_control_state *ctdb_ctrl_getrecmode_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
319
320 int ctdb_ctrl_getrecmode_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *recmode);
321
322
323 /*
324   set the recovery mode of a remote node
325  */
326 int ctdb_ctrl_setrecmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmode);
327 /*
328   get the monitoring mode of a remote node
329  */
330 int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *monmode);
331
332 /*
333   set the monitoring mode of a remote node to active
334  */
335 int ctdb_ctrl_enable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
336
337 /*
338   set the monitoring mode of a remote node to disabled
339  */
340 int ctdb_ctrl_disable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
341
342
343 /*
344   get the recovery master of a remote node
345  */
346 int ctdb_ctrl_getrecmaster(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, uint32_t *recmaster);
347
348 struct ctdb_client_control_state *ctdb_ctrl_getrecmaster_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
349
350 int ctdb_ctrl_getrecmaster_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *recmaster);
351
352
353
354 /*
355   set the recovery master of a remote node
356  */
357 int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmaster);
358
359 uint32_t *ctdb_get_connected_nodes(struct ctdb_context *ctdb,
360                                    struct timeval timeout,
361                                    TALLOC_CTX *mem_ctx,
362                                    uint32_t *num_nodes);
363
364 int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode);
365
366 int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile, bool use_syslog);
367
368 typedef int (*ctdb_traverse_func)(struct ctdb_context *, TDB_DATA, TDB_DATA, void *);
369 int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *private_data);
370
371 int ctdb_dumpdb_record(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, void *p);
372 int ctdb_dump_db(struct ctdb_db_context *ctdb_db, FILE *f);
373
374 /*
375   get the pid of a ctdb daemon
376  */
377 int ctdb_ctrl_getpid(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *pid);
378
379 int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout,
380                         uint32_t destnode);
381 int ctdb_ctrl_freeze_priority(struct ctdb_context *ctdb, struct timeval timeout,
382                               uint32_t destnode, uint32_t priority);
383
384 struct ctdb_client_control_state *
385 ctdb_ctrl_freeze_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
386                       struct timeval timeout, uint32_t destnode,
387                       uint32_t priority);
388
389 int ctdb_ctrl_freeze_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
390                         struct ctdb_client_control_state *state);
391
392 int ctdb_ctrl_thaw_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t priority);
393 int ctdb_ctrl_thaw(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
394
395 int ctdb_ctrl_getpnn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
396
397 int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb,
398                           struct timeval timeout,
399                           uint32_t destnode,
400                           const char *name, uint32_t *value);
401
402 int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb,
403                           struct timeval timeout,
404                           uint32_t destnode,
405                           const char *name, uint32_t value);
406
407 int ctdb_ctrl_list_tunables(struct ctdb_context *ctdb,
408                             struct timeval timeout,
409                             uint32_t destnode,
410                             TALLOC_CTX *mem_ctx,
411                             const char ***list, uint32_t *count);
412
413 int ctdb_ctrl_modflags(struct ctdb_context *ctdb,
414                        struct timeval timeout,
415                        uint32_t destnode,
416                        uint32_t set, uint32_t clear);
417
418 enum ctdb_server_id_type { SERVER_TYPE_SAMBA=1 };
419
420 struct ctdb_server_id {
421         enum ctdb_server_id_type type;
422         uint32_t pnn;
423         uint32_t server_id;
424 };
425
426 struct ctdb_server_id_list {
427         uint32_t num;
428         struct ctdb_server_id server_ids[1];
429 };
430
431
432 int ctdb_ctrl_register_server_id(struct ctdb_context *ctdb,
433                 struct timeval timeout,
434                 struct ctdb_server_id *id);
435 int ctdb_ctrl_unregister_server_id(struct ctdb_context *ctdb,
436                 struct timeval timeout,
437                 struct ctdb_server_id *id);
438 int ctdb_ctrl_check_server_id(struct ctdb_context *ctdb,
439                 struct timeval timeout, uint32_t destnode,
440                 struct ctdb_server_id *id, uint32_t *status);
441 int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
442                 TALLOC_CTX *mem_ctx,
443                 struct timeval timeout, uint32_t destnode,
444                 struct ctdb_server_id_list **svid_list);
445
446 struct ctdb_uptime {
447         struct timeval current_time;
448         struct timeval ctdbd_start_time;
449         struct timeval last_recovery_started;
450         struct timeval last_recovery_finished;
451 };
452
453 /*
454   definitions for different socket structures
455  */
456 typedef struct sockaddr_in ctdb_addr_in;
457 typedef struct sockaddr_in6 ctdb_addr_in6;
458 typedef union {
459         struct sockaddr sa;
460         ctdb_addr_in    ip;
461         ctdb_addr_in6   ip6;
462 } ctdb_sock_addr;
463
464 /*
465   struct for tcp_client control
466   this is an ipv4 only version of this structure used by samba
467   samba will later be migrated over to use the
468   ctdb_control_tcp_addr structure instead
469  */
470 struct ctdb_control_tcp {
471         struct sockaddr_in src; // samba uses this
472         struct sockaddr_in dest;// samba uses this
473 };
474 /* new style structure */
475 struct ctdb_control_tcp_addr {
476         ctdb_sock_addr src;
477         ctdb_sock_addr dest;
478 };
479
480 int ctdb_socket_connect(struct ctdb_context *ctdb);
481
482 /*
483   get the uptime of a remote node
484  */
485 int ctdb_ctrl_uptime(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, struct ctdb_uptime **uptime);
486
487 struct ctdb_client_control_state *ctdb_ctrl_uptime_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
488
489 int ctdb_ctrl_uptime_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, struct ctdb_uptime **uptime);
490
491 int ctdb_ctrl_end_recovery(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
492
493 int ctdb_ctrl_getreclock(struct ctdb_context *ctdb,
494         struct timeval timeout, uint32_t destnode,
495         TALLOC_CTX *mem_ctx, const char **reclock);
496 int ctdb_ctrl_setreclock(struct ctdb_context *ctdb,
497         struct timeval timeout, uint32_t destnode,
498         const char *reclock);
499
500
501 uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
502                                 struct ctdb_node_map *node_map,
503                                 TALLOC_CTX *mem_ctx,
504                                 bool include_self);
505 uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
506                                 struct ctdb_node_map *node_map,
507                                 TALLOC_CTX *mem_ctx,
508                                 bool include_self);
509 uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
510                                 struct ctdb_vnn_map *vnn_map,
511                                 TALLOC_CTX *mem_ctx,
512                                 bool include_self);
513 uint32_t *list_of_active_nodes_except_pnn(struct ctdb_context *ctdb,
514                                 struct ctdb_node_map *node_map,
515                                 TALLOC_CTX *mem_ctx,
516                                 uint32_t pnn);
517
518 int ctdb_read_pnn_lock(int fd, int32_t pnn);
519
520 /*
521   get capabilities of a remote node
522  */
523 int ctdb_ctrl_getcapabilities(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *capabilities);
524
525 struct ctdb_client_control_state *ctdb_ctrl_getcapabilities_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
526
527 int ctdb_ctrl_getcapabilities_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *capabilities);
528
529
530 int32_t ctdb_ctrl_transaction_active(struct ctdb_context *ctdb,
531                                      uint32_t destnode,
532                                      uint32_t db_id);
533
534 struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx,
535                                                struct ctdb_marshall_buffer *m,
536                                                uint64_t db_id,
537                                                uint32_t reqid,
538                                                TDB_DATA key,
539                                                struct ctdb_ltdb_header *header,
540                                                TDB_DATA data);
541 TDB_DATA ctdb_marshall_finish(struct ctdb_marshall_buffer *m);
542
543 struct ctdb_transaction_handle *ctdb_transaction_start(struct ctdb_db_context *ctdb_db,
544                                                        TALLOC_CTX *mem_ctx);
545 int ctdb_transaction_fetch(struct ctdb_transaction_handle *h,
546                            TALLOC_CTX *mem_ctx,
547                            TDB_DATA key, TDB_DATA *data);
548 int ctdb_transaction_store(struct ctdb_transaction_handle *h,
549                            TDB_DATA key, TDB_DATA data);
550 int ctdb_transaction_commit(struct ctdb_transaction_handle *h);
551
552 int ctdb_ctrl_recd_ping(struct ctdb_context *ctdb);
553
554 int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt,
555                                  ...);
556
557 int ctdb_ctrl_getscriptstatus(struct ctdb_context *ctdb,
558                     struct timeval timeout, uint32_t destnode,
559                     TALLOC_CTX *mem_ctx, enum ctdb_eventscript_call type,
560                     struct ctdb_scripts_wire **script_status);
561
562
563 struct debug_levels {
564         int32_t level;
565         const char *description;
566 };
567 extern struct debug_levels debug_levels[];
568
569 const char *get_debug_by_level(int32_t level);
570 int32_t get_debug_by_desc(const char *desc);
571
572 int ctdb_ctrl_stop_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
573 int ctdb_ctrl_continue_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
574
575 int ctdb_ctrl_setnatgwstate(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t natgwstate);
576 int ctdb_ctrl_setlmasterrole(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t lmasterrole);
577 int ctdb_ctrl_setrecmasterrole(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmasterrole);
578
579 int ctdb_ctrl_enablescript(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, const char *script);
580 int ctdb_ctrl_disablescript(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, const char *script);
581
582 struct ctdb_ban_time {
583         uint32_t pnn;
584         uint32_t time;
585 };
586
587 int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, struct ctdb_ban_time *bantime);
588 int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, struct ctdb_ban_time **bantime);
589
590 struct ctdb_db_priority {
591         uint32_t db_id;
592         uint32_t priority;
593 };
594
595 int ctdb_ctrl_set_db_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, struct ctdb_db_priority *db_prio);
596 int ctdb_ctrl_get_db_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t db_id, uint32_t *priority);
597
598 #endif /* _CTDB_CLIENT_H */