s3-auth: Do not leak tmp_ctx if make_server_info() fails.
[Samba/wip.git] / ctdb / include / ctdb_client.h
blobd3084273ea5852419bdd182a96de4ab700eced47
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
22 #include "ctdb_protocol.h"
24 enum control_state {CTDB_CONTROL_WAIT, CTDB_CONTROL_DONE, CTDB_CONTROL_ERROR, CTDB_CONTROL_TIMEOUT};
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;
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
39 struct {
40 void (*fn)(struct ctdb_client_control_state *);
41 void *private_data;
42 } async;
45 struct ctdb_client_notify_register {
46 uint64_t srvid;
47 uint32_t len;
48 uint8_t notify_data[1];
51 struct ctdb_client_notify_deregister {
52 uint64_t srvid;
55 struct tevent_context;
58 initialise ctdb subsystem
60 struct ctdb_context *ctdb_init(struct tevent_context *ev);
63 choose the transport
65 int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport);
68 set some flags
70 void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags);
73 tell ctdb what address to listen on, in transport specific format
75 int ctdb_set_address(struct ctdb_context *ctdb, const char *address);
77 int ctdb_set_socketname(struct ctdb_context *ctdb, const char *socketname);
78 const char *ctdb_get_socketname(struct ctdb_context *ctdb);
81 Check that a specific ip address exists in the node list and returns
82 the id for the node or -1
84 int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const char *nodeip);
87 start the ctdb protocol
89 int ctdb_start(struct ctdb_context *ctdb);
92 attach to a ctdb database
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);
102 find an attached ctdb_db handle given a name
104 struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, const char *name);
107 error string for last ctdb error
109 const char *ctdb_errstr(struct ctdb_context *);
111 /* a ctdb call function */
112 typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
115 setup a ctdb call function
117 int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id);
122 make a ctdb call. The associated ctdb call function will be called on the DMASTER
123 for the given record
125 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
128 initiate an ordered ctdb cluster shutdown
129 this function will never return
131 void ctdb_shutdown(struct ctdb_context *ctdb);
133 /* return pnn of this node */
134 uint32_t ctdb_get_pnn(struct ctdb_context *ctdb);
137 return the number of nodes
139 uint32_t ctdb_get_num_nodes(struct ctdb_context *ctdb);
141 /* setup a handler for ctdb messages */
142 typedef void (*ctdb_msg_fn_t)(struct ctdb_context *, uint64_t srvid,
143 TDB_DATA data, void *);
144 int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
145 ctdb_msg_fn_t handler,
146 void *private_data);
147 int ctdb_client_remove_message_handler(struct ctdb_context *ctdb,
148 uint64_t srvid, void *private_data);
149 int ctdb_client_check_message_handlers(struct ctdb_context *ctdb,
150 uint64_t *ids, uint32_t num,
151 uint8_t *result);
153 int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
154 struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
155 int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call);
157 /* send a ctdb message */
158 int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t pnn,
159 uint64_t srvid, TDB_DATA data);
163 Fetch a ctdb record from a remote node
164 . Underneath this will force the
165 dmaster for the record to be moved to the local node.
167 struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
168 TDB_DATA key, TDB_DATA *data);
170 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 int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
174 int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
175 TDB_DATA key, TDB_DATA *data);
177 int ctdb_register_message_handler(struct ctdb_context *ctdb,
178 TALLOC_CTX *mem_ctx,
179 uint64_t srvid,
180 ctdb_msg_fn_t handler,
181 void *private_data);
183 struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id);
186 struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
187 struct timeval req_timeout);
189 struct ctdb_statistics;
190 int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status);
191 int ctdb_ctrl_dbstatistics(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
192 TALLOC_CTX *mem_ctx, struct ctdb_db_statistics **dbstat);
194 int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
196 struct ctdb_vnn_map;
197 int ctdb_ctrl_getvnnmap(struct ctdb_context *ctdb,
198 struct timeval timeout, uint32_t destnode,
199 TALLOC_CTX *mem_ctx, struct ctdb_vnn_map **vnnmap);
200 int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb,
201 struct timeval timeout, uint32_t destnode,
202 TALLOC_CTX *mem_ctx, struct ctdb_vnn_map *vnnmap);
204 /* table that contains a list of all dbids on a node
206 struct ctdb_dbid_map {
207 uint32_t num;
208 struct ctdb_dbid {
209 uint32_t dbid;
210 #define CTDB_DB_FLAGS_PERSISTENT 0x01
211 #define CTDB_DB_FLAGS_READONLY 0x02
212 #define CTDB_DB_FLAGS_STICKY 0x04
213 uint8_t flags;
214 } dbs[1];
216 int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb,
217 struct timeval timeout, uint32_t destnode,
218 TALLOC_CTX *mem_ctx, struct ctdb_dbid_map **dbmap);
221 struct ctdb_node_map;
223 int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
224 struct timeval timeout, uint32_t destnode,
225 TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
227 int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb,
228 struct timeval timeout, uint32_t destnode,
229 TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
231 int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb,
232 struct timeval timeout, uint32_t destnode);
234 struct ctdb_key_list {
235 uint32_t dbid;
236 uint32_t num;
237 TDB_DATA *keys;
238 struct ctdb_ltdb_header *headers;
239 TDB_DATA *data;
242 int ctdb_ctrl_pulldb(
243 struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
244 uint32_t lmaster, TALLOC_CTX *mem_ctx,
245 struct timeval timeout, TDB_DATA *outdata);
247 struct ctdb_client_control_state *ctdb_ctrl_pulldb_send(
248 struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
249 uint32_t lmaster, TALLOC_CTX *mem_ctx, struct timeval timeout);
251 int ctdb_ctrl_pulldb_recv(
252 struct ctdb_context *ctdb,
253 TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state,
254 TDB_DATA *outdata);
256 int ctdb_ctrl_pushdb(
257 struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
258 TALLOC_CTX *mem_ctx,
259 struct timeval timeout, TDB_DATA indata);
261 struct ctdb_client_control_state *ctdb_ctrl_pushdb_send(
262 struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
263 TALLOC_CTX *mem_ctx, struct timeval timeout,
264 TDB_DATA indata);
266 int ctdb_ctrl_pushdb_recv(
267 struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
268 struct ctdb_client_control_state *state);
271 int ctdb_ctrl_copydb(struct ctdb_context *ctdb,
272 struct timeval timeout, uint32_t sourcenode,
273 uint32_t destnode, uint32_t dbid, uint32_t lmaster,
274 TALLOC_CTX *mem_ctx);
276 int ctdb_ctrl_getdbpath(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx, const char **path);
277 int ctdb_ctrl_getdbname(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx, const char **name);
278 int ctdb_ctrl_getdbhealth(struct ctdb_context *ctdb,
279 struct timeval timeout,
280 uint32_t destnode,
281 uint32_t dbid, TALLOC_CTX *mem_ctx,
282 const char **reason);
283 int ctdb_ctrl_getdbseqnum(struct ctdb_context *ctdb, struct timeval timeout,
284 uint32_t destnode, uint32_t dbid, uint64_t *seqnum);
285 int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, const char *name, bool persistent);
287 int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode, pid_t pid);
289 int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode);
291 int ctdb_ctrl_get_runstate(struct ctdb_context *ctdb,
292 struct timeval timeout,
293 uint32_t destnode,
294 uint32_t *runstate);
296 int ctdb_ctrl_get_config(struct ctdb_context *ctdb);
298 int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t *level);
299 int ctdb_ctrl_set_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t level);
302 change dmaster for all keys in the database to the new value
304 int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb,
305 struct timeval timeout, uint32_t destnode,
306 TALLOC_CTX *mem_ctx, uint32_t dbid, uint32_t dmaster);
309 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 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 #define CTDB_RECOVERY_NORMAL 0
314 #define CTDB_RECOVERY_ACTIVE 1
317 get the recovery mode of a remote node
319 int ctdb_ctrl_getrecmode(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, uint32_t *recmode);
321 struct ctdb_client_control_state *ctdb_ctrl_getrecmode_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
323 int ctdb_ctrl_getrecmode_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *recmode);
327 set the recovery mode of a remote node
329 int ctdb_ctrl_setrecmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmode);
331 get the monitoring mode of a remote node
333 int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *monmode);
336 set the monitoring mode of a remote node to active
338 int ctdb_ctrl_enable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
341 set the monitoring mode of a remote node to disabled
343 int ctdb_ctrl_disable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
347 get the recovery master of a remote node
349 int ctdb_ctrl_getrecmaster(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, uint32_t *recmaster);
351 struct ctdb_client_control_state *ctdb_ctrl_getrecmaster_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
353 int ctdb_ctrl_getrecmaster_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *recmaster);
358 set the recovery master of a remote node
360 int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmaster);
362 uint32_t *ctdb_get_connected_nodes(struct ctdb_context *ctdb,
363 struct timeval timeout,
364 TALLOC_CTX *mem_ctx,
365 uint32_t *num_nodes);
367 int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode);
369 int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile, bool use_syslog);
371 typedef int (*ctdb_traverse_func)(struct ctdb_context *, TDB_DATA, TDB_DATA, void *);
372 int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *private_data);
374 struct ctdb_dump_db_context {
375 FILE *f;
376 bool printemptyrecords;
377 bool printdatasize;
378 bool printlmaster;
379 bool printhash;
380 bool printrecordflags;
383 int ctdb_dumpdb_record(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, void *p);
384 int ctdb_dump_db(struct ctdb_db_context *ctdb_db,
385 struct ctdb_dump_db_context *ctx);
388 get the pid of a ctdb daemon
390 int ctdb_ctrl_getpid(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *pid);
392 int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout,
393 uint32_t destnode);
394 int ctdb_ctrl_freeze_priority(struct ctdb_context *ctdb, struct timeval timeout,
395 uint32_t destnode, uint32_t priority);
397 struct ctdb_client_control_state *
398 ctdb_ctrl_freeze_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
399 struct timeval timeout, uint32_t destnode,
400 uint32_t priority);
402 int ctdb_ctrl_freeze_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
403 struct ctdb_client_control_state *state);
405 int ctdb_ctrl_thaw_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t priority);
406 int ctdb_ctrl_thaw(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
408 int ctdb_ctrl_getpnn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
410 int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb,
411 struct timeval timeout,
412 uint32_t destnode,
413 const char *name, uint32_t *value);
415 int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb,
416 struct timeval timeout,
417 uint32_t destnode,
418 const char *name, uint32_t value);
420 int ctdb_ctrl_list_tunables(struct ctdb_context *ctdb,
421 struct timeval timeout,
422 uint32_t destnode,
423 TALLOC_CTX *mem_ctx,
424 const char ***list, uint32_t *count);
426 int ctdb_ctrl_modflags(struct ctdb_context *ctdb,
427 struct timeval timeout,
428 uint32_t destnode,
429 uint32_t set, uint32_t clear);
431 enum ctdb_server_id_type {
432 SERVER_TYPE_SAMBA=1,
433 SERVER_TYPE_NFSD=2,
434 SERVER_TYPE_ISCSID=3
437 struct ctdb_server_id {
438 enum ctdb_server_id_type type;
439 uint32_t pnn;
440 uint32_t server_id;
443 struct ctdb_server_id_list {
444 uint32_t num;
445 struct ctdb_server_id server_ids[1];
449 int ctdb_ctrl_register_server_id(struct ctdb_context *ctdb,
450 struct timeval timeout,
451 struct ctdb_server_id *id);
452 int ctdb_ctrl_unregister_server_id(struct ctdb_context *ctdb,
453 struct timeval timeout,
454 struct ctdb_server_id *id);
455 int ctdb_ctrl_check_server_id(struct ctdb_context *ctdb,
456 struct timeval timeout, uint32_t destnode,
457 struct ctdb_server_id *id, uint32_t *status);
458 int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
459 TALLOC_CTX *mem_ctx,
460 struct timeval timeout, uint32_t destnode,
461 struct ctdb_server_id_list **svid_list);
463 struct ctdb_uptime {
464 struct timeval current_time;
465 struct timeval ctdbd_start_time;
466 struct timeval last_recovery_started;
467 struct timeval last_recovery_finished;
471 struct for tcp_client control
472 this is an ipv4 only version of this structure used by samba
473 samba will later be migrated over to use the
474 ctdb_control_tcp_addr structure instead
476 struct ctdb_control_tcp {
477 struct sockaddr_in src; /* samba uses this */
478 struct sockaddr_in dest; /* samba uses this */
480 /* new style structure */
481 struct ctdb_control_tcp_addr {
482 ctdb_sock_addr src;
483 ctdb_sock_addr dest;
486 int ctdb_socket_connect(struct ctdb_context *ctdb);
489 get the uptime of a remote node
491 int ctdb_ctrl_uptime(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode, struct ctdb_uptime **uptime);
493 struct ctdb_client_control_state *ctdb_ctrl_uptime_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
495 int ctdb_ctrl_uptime_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, struct ctdb_uptime **uptime);
497 int ctdb_ctrl_end_recovery(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
499 int ctdb_ctrl_getreclock(struct ctdb_context *ctdb,
500 struct timeval timeout, uint32_t destnode,
501 TALLOC_CTX *mem_ctx, const char **reclock);
502 int ctdb_ctrl_setreclock(struct ctdb_context *ctdb,
503 struct timeval timeout, uint32_t destnode,
504 const char *reclock);
507 uint32_t *list_of_nodes(struct ctdb_context *ctdb,
508 struct ctdb_node_map *node_map,
509 TALLOC_CTX *mem_ctx,
510 uint32_t mask,
511 int exclude_pnn);
512 uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
513 struct ctdb_node_map *node_map,
514 TALLOC_CTX *mem_ctx,
515 bool include_self);
516 uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
517 struct ctdb_node_map *node_map,
518 TALLOC_CTX *mem_ctx,
519 bool include_self);
520 uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
521 struct ctdb_vnn_map *vnn_map,
522 TALLOC_CTX *mem_ctx,
523 bool include_self);
525 int ctdb_read_pnn_lock(int fd, int32_t pnn);
528 get capabilities of a remote node
530 int ctdb_ctrl_getcapabilities(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *capabilities);
532 struct ctdb_client_control_state *ctdb_ctrl_getcapabilities_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode);
534 int ctdb_ctrl_getcapabilities_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *capabilities);
536 struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx,
537 struct ctdb_marshall_buffer *m,
538 uint64_t db_id,
539 uint32_t reqid,
540 TDB_DATA key,
541 struct ctdb_ltdb_header *header,
542 TDB_DATA data);
543 TDB_DATA ctdb_marshall_finish(struct ctdb_marshall_buffer *m);
545 struct ctdb_transaction_handle *ctdb_transaction_start(struct ctdb_db_context *ctdb_db,
546 TALLOC_CTX *mem_ctx);
547 int ctdb_transaction_fetch(struct ctdb_transaction_handle *h,
548 TALLOC_CTX *mem_ctx,
549 TDB_DATA key, TDB_DATA *data);
550 int ctdb_transaction_store(struct ctdb_transaction_handle *h,
551 TDB_DATA key, TDB_DATA data);
552 int ctdb_transaction_commit(struct ctdb_transaction_handle *h);
553 int ctdb_transaction_cancel(struct ctdb_transaction_handle *h);
555 int ctdb_ctrl_recd_ping(struct ctdb_context *ctdb);
557 int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt,
558 ...);
560 int ctdb_ctrl_getscriptstatus(struct ctdb_context *ctdb,
561 struct timeval timeout, uint32_t destnode,
562 TALLOC_CTX *mem_ctx, enum ctdb_eventscript_call type,
563 struct ctdb_scripts_wire **script_status);
566 struct debug_levels {
567 int32_t level;
568 const char *description;
570 extern struct debug_levels debug_levels[];
572 const char *get_debug_by_level(int32_t level);
573 int32_t get_debug_by_desc(const char *desc);
575 int ctdb_ctrl_stop_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
576 int ctdb_ctrl_continue_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
578 int ctdb_ctrl_setnatgwstate(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t natgwstate);
579 int ctdb_ctrl_setlmasterrole(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t lmasterrole);
580 int ctdb_ctrl_setrecmasterrole(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t recmasterrole);
582 int ctdb_ctrl_enablescript(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, const char *script);
583 int ctdb_ctrl_disablescript(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, const char *script);
585 struct ctdb_ban_time {
586 uint32_t pnn;
587 uint32_t time;
590 int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, struct ctdb_ban_time *bantime);
591 int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, struct ctdb_ban_time **bantime);
593 struct ctdb_db_priority {
594 uint32_t db_id;
595 uint32_t priority;
598 int ctdb_ctrl_set_db_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, struct ctdb_db_priority *db_prio);
599 int ctdb_ctrl_get_db_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t db_id, uint32_t *priority);
601 int ctdb_ctrl_getstathistory(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, struct ctdb_statistics_wire **stats);
605 struct ctdb_client_control_state *
606 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);
608 int ctdb_ctrl_updaterecord_recv(struct ctdb_context *ctdb, struct ctdb_client_control_state *state);
611 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);
614 struct ctdb_client_control_state *
615 ctdb_ctrl_set_db_readonly_send(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
616 int ctdb_ctrl_set_db_readonly_recv(struct ctdb_context *ctdb, struct ctdb_client_control_state *state);
617 int ctdb_ctrl_set_db_readonly(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
619 struct ctdb_client_control_state *
620 ctdb_ctrl_set_db_sticky_send(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
621 int ctdb_ctrl_set_db_sticky_recv(struct ctdb_context *ctdb, struct ctdb_client_control_state *state);
622 int ctdb_ctrl_set_db_sticky(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid);
624 #endif /* _CTDB_CLIENT_H */