s4:rpc_server/lsa: remove unused allow_warnings=True
[obnox/samba/samba-obnox.git] / ctdb / 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 some flags
69 */
70 void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags);
71
72 /*
73   tell ctdb what address to listen on, in transport specific format
74 */
75 int ctdb_set_address(struct ctdb_context *ctdb, const char *address);
76
77 int ctdb_set_socketname(struct ctdb_context *ctdb, const char *socketname);
78 const char *ctdb_get_socketname(struct ctdb_context *ctdb);
79
80 /*
81   Check that a specific ip address exists in the node list and returns
82   the id for the node or -1
83 */
84 int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const char *nodeip);
85
86 /*
87   start the ctdb protocol
88 */
89 int ctdb_start(struct ctdb_context *ctdb);
90
91 /*
92   attach to a ctdb database
93 */
94 struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
95                                     struct timeval timeout,
96                                     const char *name,
97                                     bool persistent,
98                                     uint32_t tdb_flags);
99
100 int ctdb_detach(struct ctdb_context *ctdb, uint32_t db_id);
101
102 /*
103   find an attached ctdb_db handle given a name
104  */
105 struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, const char *name);
106
107 /*
108   error string for last ctdb error
109 */
110 const char *ctdb_errstr(struct ctdb_context *);
111
112 /* a ctdb call function */
113 typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
114
115 /*
116   setup a ctdb call function
117 */
118 int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id);
119
120
121
122 /*
123   make a ctdb call. The associated ctdb call function will be called on the DMASTER
124   for the given record
125 */
126 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
127
128 /*
129   initiate an ordered ctdb cluster shutdown
130   this function will never return
131 */
132 void ctdb_shutdown(struct ctdb_context *ctdb);
133
134 /* return pnn of this node */
135 uint32_t ctdb_get_pnn(struct ctdb_context *ctdb);
136
137 /*
138   return the number of nodes
139 */
140 uint32_t ctdb_get_num_nodes(struct ctdb_context *ctdb);
141
142 /* setup a handler for ctdb messages */
143 typedef void (*ctdb_msg_fn_t)(struct ctdb_context *, uint64_t srvid,
144                                   TDB_DATA data, void *);
145 int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
146                              ctdb_msg_fn_t handler,
147                              void *private_data);
148 int ctdb_client_remove_message_handler(struct ctdb_context *ctdb,
149                                        uint64_t srvid, void *private_data);
150 int ctdb_client_check_message_handlers(struct ctdb_context *ctdb,
151                                        uint64_t *ids, uint32_t num,
152                                        uint8_t *result);
153
154 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
155 struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
156 int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call);
157
158 /* send a ctdb message */
159 int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t pnn,
160                       uint64_t srvid, TDB_DATA data);
161
162
163 /*
164    Fetch a ctdb record from a remote node
165  . Underneath this will force the
166    dmaster for the record to be moved to the local node.
167 */
168 struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
169                                            TDB_DATA key, TDB_DATA *data);
170
171 struct ctdb_record_handle *ctdb_fetch_readonly_lock(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, TDB_DATA key, TDB_DATA *data, int read_only);
172
173 int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
174
175 int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
176                TDB_DATA key, TDB_DATA *data);
177
178 int ctdb_register_message_handler(struct ctdb_context *ctdb,
179                                   TALLOC_CTX *mem_ctx,
180                                   uint64_t srvid,
181                                   ctdb_msg_fn_t handler,
182                                   void *private_data);
183
184 struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id);
185
186
187 struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
188                                          struct timeval req_timeout);
189
190 struct ctdb_statistics;
191 int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status);
192 int ctdb_ctrl_dbstatistics(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
193                            TALLOC_CTX *mem_ctx, struct ctdb_db_statistics **dbstat);
194
195 int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
196
197 struct ctdb_vnn_map;
198 int ctdb_ctrl_getvnnmap(struct ctdb_context *ctdb,
199                 struct timeval timeout, uint32_t destnode,
200                 TALLOC_CTX *mem_ctx, struct ctdb_vnn_map **vnnmap);
201 int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb,
202                 struct timeval timeout, uint32_t destnode,
203                 TALLOC_CTX *mem_ctx, struct ctdb_vnn_map *vnnmap);
204
205 /* table that contains a list of all dbids on a node
206  */
207 struct ctdb_dbid_map {
208         uint32_t num;
209         struct ctdb_dbid {
210                 uint32_t dbid;
211 #define CTDB_DB_FLAGS_PERSISTENT        0x01
212 #define CTDB_DB_FLAGS_READONLY          0x02
213 #define CTDB_DB_FLAGS_STICKY            0x04
214                 uint8_t flags;
215         } dbs[1];
216 };
217 int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb,
218         struct timeval timeout, uint32_t destnode,
219         TALLOC_CTX *mem_ctx, struct ctdb_dbid_map **dbmap);
220
221
222 struct ctdb_node_map;
223
224 int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
225                     struct timeval timeout, uint32_t destnode,
226                     TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
227
228 int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb,
229                     struct timeval timeout, uint32_t destnode,
230                     TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
231
232 int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb,
233                     struct timeval timeout, uint32_t destnode);
234
235 struct ctdb_key_list {
236         uint32_t dbid;
237         uint32_t num;
238         TDB_DATA *keys;
239         struct ctdb_ltdb_header *headers;
240         TDB_DATA *data;
241 };
242
243 int ctdb_ctrl_pulldb(
244        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
245        uint32_t lmaster, TALLOC_CTX *mem_ctx,
246        struct timeval timeout, TDB_DATA *outdata);
247
248 struct ctdb_client_control_state *ctdb_ctrl_pulldb_send(
249        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
250        uint32_t lmaster, TALLOC_CTX *mem_ctx, struct timeval timeout);
251
252 int ctdb_ctrl_pulldb_recv(
253        struct ctdb_context *ctdb,
254        TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state,
255        TDB_DATA *outdata);
256
257 int ctdb_ctrl_pushdb(
258        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
259        TALLOC_CTX *mem_ctx,
260        struct timeval timeout, TDB_DATA indata);
261
262 struct ctdb_client_control_state *ctdb_ctrl_pushdb_send(
263        struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
264        TALLOC_CTX *mem_ctx, struct timeval timeout,
265        TDB_DATA indata);
266
267 int ctdb_ctrl_pushdb_recv(
268        struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
269        struct ctdb_client_control_state *state);
270
271
272 int ctdb_ctrl_copydb(struct ctdb_context *ctdb,
273         struct timeval timeout, uint32_t sourcenode,
274         uint32_t destnode, uint32_t dbid, uint32_t lmaster,
275         TALLOC_CTX *mem_ctx);
276
277 int ctdb_ctrl_getdbpath(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx, const char **path);
278 int ctdb_ctrl_getdbname(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx, const char **name);
279 int ctdb_ctrl_getdbhealth(struct ctdb_context *ctdb,
280                           struct timeval timeout,
281                           uint32_t destnode,
282                           uint32_t dbid, TALLOC_CTX *mem_ctx,
283                           const char **reason);
284 int ctdb_ctrl_getdbseqnum(struct ctdb_context *ctdb, struct timeval timeout,
285                           uint32_t destnode, uint32_t dbid, uint64_t *seqnum);
286 int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, const char *name, bool persistent);
287
288 int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode, pid_t pid);
289
290 int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode);
291
292 int ctdb_ctrl_get_runstate(struct ctdb_context *ctdb, 
293                            struct timeval timeout, 
294                            uint32_t destnode,
295                            uint32_t *runstate);
296
297 int ctdb_ctrl_get_config(struct ctdb_context *ctdb);
298
299 int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t *level);
300 int ctdb_ctrl_set_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t level);
301
302 /*
303   change dmaster for all keys in the database to the new value
304  */
305 int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb,
306         struct timeval timeout, uint32_t destnode,
307         TALLOC_CTX *mem_ctx, uint32_t dbid, uint32_t dmaster);
308
309 /*
310   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)
311  */
312 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);
313
314 #define CTDB_RECOVERY_NORMAL            0
315 #define CTDB_RECOVERY_ACTIVE            1
316
317 /*
318   get the recovery mode of a remote node
319  */
320 int ctdb_ctrl_getrecmode(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, uint32_t *recmode);
321
322 struct ctdb_client_control_state *ctdb_ctrl_getrecmode_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
323
324 int ctdb_ctrl_getrecmode_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *recmode);
325
326
327 /*
328   set the recovery mode of a remote node
329  */
330 int ctdb_ctrl_setrecmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmode);
331 /*
332   get the monitoring mode of a remote node
333  */
334 int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *monmode);
335
336 /*
337   set the monitoring mode of a remote node to active
338  */
339 int ctdb_ctrl_enable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
340
341 /*
342   set the monitoring mode of a remote node to disabled
343  */
344 int ctdb_ctrl_disable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
345
346
347 /*
348   get the recovery master of a remote node
349  */
350 int ctdb_ctrl_getrecmaster(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, uint32_t *recmaster);
351
352 struct ctdb_client_control_state *ctdb_ctrl_getrecmaster_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
353
354 int ctdb_ctrl_getrecmaster_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *recmaster);
355
356
357
358 /*
359   set the recovery master of a remote node
360  */
361 int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmaster);
362
363 uint32_t *ctdb_get_connected_nodes(struct ctdb_context *ctdb,
364                                    struct timeval timeout,
365                                    TALLOC_CTX *mem_ctx,
366                                    uint32_t *num_nodes);
367
368 int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode);
369
370 typedef int (*ctdb_traverse_func)(struct ctdb_context *, TDB_DATA, TDB_DATA, void *);
371 int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *private_data);
372
373 struct ctdb_dump_db_context {
374         FILE *f;
375         bool printemptyrecords;
376         bool printdatasize;
377         bool printlmaster;
378         bool printhash;
379         bool printrecordflags;
380 };
381
382 int ctdb_dumpdb_record(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, void *p);
383 int ctdb_dump_db(struct ctdb_db_context *ctdb_db,
384                  struct ctdb_dump_db_context *ctx);
385
386 /*
387   get the pid of a ctdb daemon
388  */
389 int ctdb_ctrl_getpid(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *pid);
390
391 int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout,
392                         uint32_t destnode);
393 int ctdb_ctrl_freeze_priority(struct ctdb_context *ctdb, struct timeval timeout,
394                               uint32_t destnode, uint32_t priority);
395
396 struct ctdb_client_control_state *
397 ctdb_ctrl_freeze_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
398                       struct timeval timeout, uint32_t destnode,
399                       uint32_t priority);
400
401 int ctdb_ctrl_freeze_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
402                         struct ctdb_client_control_state *state);
403
404 int ctdb_ctrl_thaw_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t priority);
405 int ctdb_ctrl_thaw(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
406
407 int ctdb_ctrl_getpnn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
408
409 int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb,
410                           struct timeval timeout,
411                           uint32_t destnode,
412                           const char *name, uint32_t *value);
413
414 int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb,
415                           struct timeval timeout,
416                           uint32_t destnode,
417                           const char *name, uint32_t value);
418
419 int ctdb_ctrl_list_tunables(struct ctdb_context *ctdb,
420                             struct timeval timeout,
421                             uint32_t destnode,
422                             TALLOC_CTX *mem_ctx,
423                             const char ***list, uint32_t *count);
424
425 int ctdb_ctrl_modflags(struct ctdb_context *ctdb,
426                        struct timeval timeout,
427                        uint32_t destnode,
428                        uint32_t set, uint32_t clear);
429
430 enum ctdb_server_id_type {
431         SERVER_TYPE_SAMBA=1,
432         SERVER_TYPE_NFSD=2,
433         SERVER_TYPE_ISCSID=3
434 };
435
436 struct ctdb_server_id {
437         enum ctdb_server_id_type type;
438         uint32_t pnn;
439         uint32_t server_id;
440 };
441
442 struct ctdb_server_id_list {
443         uint32_t num;
444         struct ctdb_server_id server_ids[1];
445 };
446
447
448 int ctdb_ctrl_register_server_id(struct ctdb_context *ctdb,
449                 struct timeval timeout,
450                 struct ctdb_server_id *id);
451 int ctdb_ctrl_unregister_server_id(struct ctdb_context *ctdb,
452                 struct timeval timeout,
453                 struct ctdb_server_id *id);
454 int ctdb_ctrl_check_server_id(struct ctdb_context *ctdb,
455                 struct timeval timeout, uint32_t destnode,
456                 struct ctdb_server_id *id, uint32_t *status);
457 int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
458                 TALLOC_CTX *mem_ctx,
459                 struct timeval timeout, uint32_t destnode,
460                 struct ctdb_server_id_list **svid_list);
461
462 struct ctdb_uptime {
463         struct timeval current_time;
464         struct timeval ctdbd_start_time;
465         struct timeval last_recovery_started;
466         struct timeval last_recovery_finished;
467 };
468
469 /*
470   struct for tcp_client control
471   this is an ipv4 only version of this structure used by samba
472   samba will later be migrated over to use the
473   ctdb_control_tcp_addr structure instead
474  */
475 struct ctdb_control_tcp {
476         struct sockaddr_in src;  /* samba uses this */
477         struct sockaddr_in dest; /* samba uses this */
478 };
479 /* new style structure */
480 struct ctdb_control_tcp_addr {
481         ctdb_sock_addr src;
482         ctdb_sock_addr dest;
483 };
484
485 int ctdb_socket_connect(struct ctdb_context *ctdb);
486
487 /*
488   get the uptime of a remote node
489  */
490 int ctdb_ctrl_uptime(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, struct ctdb_uptime **uptime);
491
492 struct ctdb_client_control_state *ctdb_ctrl_uptime_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
493
494 int ctdb_ctrl_uptime_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, struct ctdb_uptime **uptime);
495
496 int ctdb_ctrl_end_recovery(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
497
498 int ctdb_ctrl_getreclock(struct ctdb_context *ctdb,
499         struct timeval timeout, uint32_t destnode,
500         TALLOC_CTX *mem_ctx, const char **reclock);
501 int ctdb_ctrl_setreclock(struct ctdb_context *ctdb,
502         struct timeval timeout, uint32_t destnode,
503         const char *reclock);
504
505
506 uint32_t *list_of_nodes(struct ctdb_context *ctdb,
507                         struct ctdb_node_map *node_map,
508                         TALLOC_CTX *mem_ctx,
509                         uint32_t mask,
510                         int exclude_pnn);
511 uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
512                                 struct ctdb_node_map *node_map,
513                                 TALLOC_CTX *mem_ctx,
514                                 bool include_self);
515 uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
516                                 struct ctdb_node_map *node_map,
517                                 TALLOC_CTX *mem_ctx,
518                                 bool include_self);
519 uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
520                                 struct ctdb_vnn_map *vnn_map,
521                                 TALLOC_CTX *mem_ctx,
522                                 bool include_self);
523
524 int ctdb_read_pnn_lock(int fd, int32_t pnn);
525
526 /*
527   get capabilities of a remote node
528  */
529 int ctdb_ctrl_getcapabilities(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *capabilities);
530
531 struct ctdb_client_control_state *ctdb_ctrl_getcapabilities_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
532
533 int ctdb_ctrl_getcapabilities_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *capabilities);
534
535 struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx,
536                                                struct ctdb_marshall_buffer *m,
537                                                uint64_t db_id,
538                                                uint32_t reqid,
539                                                TDB_DATA key,
540                                                struct ctdb_ltdb_header *header,
541                                                TDB_DATA data);
542 TDB_DATA ctdb_marshall_finish(struct ctdb_marshall_buffer *m);
543
544 struct ctdb_transaction_handle *ctdb_transaction_start(struct ctdb_db_context *ctdb_db,
545                                                        TALLOC_CTX *mem_ctx);
546 int ctdb_transaction_fetch(struct ctdb_transaction_handle *h,
547                            TALLOC_CTX *mem_ctx,
548                            TDB_DATA key, TDB_DATA *data);
549 int ctdb_transaction_store(struct ctdb_transaction_handle *h,
550                            TDB_DATA key, TDB_DATA data);
551 int ctdb_transaction_commit(struct ctdb_transaction_handle *h);
552 int ctdb_transaction_cancel(struct ctdb_transaction_handle *h);
553
554 int ctdb_ctrl_recd_ping(struct ctdb_context *ctdb);
555
556 int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt,
557                                  ...);
558
559 int ctdb_ctrl_getscriptstatus(struct ctdb_context *ctdb,
560                     struct timeval timeout, uint32_t destnode,
561                     TALLOC_CTX *mem_ctx, enum ctdb_eventscript_call type,
562                     struct ctdb_scripts_wire **script_status);
563
564
565 int ctdb_ctrl_stop_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
566 int ctdb_ctrl_continue_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
567
568 int ctdb_ctrl_setnatgwstate(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t natgwstate);
569 int ctdb_ctrl_setlmasterrole(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t lmasterrole);
570 int ctdb_ctrl_setrecmasterrole(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmasterrole);
571
572 int ctdb_ctrl_enablescript(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, const char *script);
573 int ctdb_ctrl_disablescript(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, const char *script);
574
575 struct ctdb_ban_time {
576         uint32_t pnn;
577         uint32_t time;
578 };
579
580 int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, struct ctdb_ban_time *bantime);
581 int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, struct ctdb_ban_time **bantime);
582
583 struct ctdb_db_priority {
584         uint32_t db_id;
585         uint32_t priority;
586 };
587
588 int ctdb_ctrl_set_db_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, struct ctdb_db_priority *db_prio);
589 int ctdb_ctrl_get_db_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t db_id, uint32_t *priority);
590
591 int ctdb_ctrl_getstathistory(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, struct ctdb_statistics_wire **stats);
592
593
594
595 struct ctdb_client_control_state *
596 ctdb_ctrl_updaterecord_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, struct ctdb_db_context *ctdb_db, TDB_DATA key, struct ctdb_ltdb_header *header, TDB_DATA data);
597
598 int ctdb_ctrl_updaterecord_recv(struct ctdb_context *ctdb, struct ctdb_client_control_state *state);
599
600 int
601 ctdb_ctrl_updaterecord(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, struct ctdb_db_context *ctdb_db, TDB_DATA key, struct ctdb_ltdb_header *header, TDB_DATA data);
602
603
604 struct ctdb_client_control_state *
605 ctdb_ctrl_set_db_readonly_send(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
606 int ctdb_ctrl_set_db_readonly_recv(struct ctdb_context *ctdb, struct ctdb_client_control_state *state);
607 int ctdb_ctrl_set_db_readonly(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
608
609 struct ctdb_client_control_state *
610 ctdb_ctrl_set_db_sticky_send(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
611 int ctdb_ctrl_set_db_sticky_recv(struct ctdb_context *ctdb, struct ctdb_client_control_state *state);
612 int ctdb_ctrl_set_db_sticky(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
613
614 #endif /* _CTDB_CLIENT_H */