2010-05-20 09:48:30 +04:00
/*
ctdb database library : old client interface
2006-11-18 02:41:20 +03:00
Copyright ( C ) Andrew Tridgell 2006
2007-05-31 07:50:53 +04:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 09:29:31 +04:00
the Free Software Foundation ; either version 3 of the License , or
2007-05-31 07:50:53 +04:00
( at your option ) any later version .
2010-05-20 09:48:30 +04:00
2007-05-31 07:50:53 +04:00
This program is distributed in the hope that it will be useful ,
2006-11-18 02:41:20 +03:00
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2007-05-31 07:50:53 +04:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
2010-05-20 09:48:30 +04:00
2007-05-31 07:50:53 +04:00
You should have received a copy of the GNU General Public License
2007-07-10 09:29:31 +04:00
along with this program ; if not , see < http : //www.gnu.org/licenses/>.
2006-11-18 02:41:20 +03:00
*/
2010-05-20 09:48:30 +04:00
# ifndef _CTDB_CLIENT_H
# define _CTDB_CLIENT_H
2015-04-08 07:38:26 +03:00
# include "common/srvid.h"
2012-10-09 13:39:58 +04:00
# include "ctdb_protocol.h"
2009-12-11 16:19:55 +03:00
2015-10-27 09:34:06 +03:00
enum control_state {
CTDB_CONTROL_WAIT ,
CTDB_CONTROL_DONE ,
CTDB_CONTROL_ERROR ,
CTDB_CONTROL_TIMEOUT
} ;
2007-08-23 13:27:09 +04:00
2007-08-24 04:42:06 +04:00
struct ctdb_client_control_state {
struct ctdb_context * ctdb ;
uint32_t reqid ;
2007-08-23 13:27:09 +04:00
int32_t status ;
TDB_DATA outdata ;
2007-08-24 04:42:06 +04:00
enum control_state state ;
2007-08-23 13:27:09 +04:00
char * errormsg ;
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ;
2007-08-24 04:42:06 +04:00
/* if we have a callback registered for the completion (or failure) of
this control
if a callback is used , it MUST talloc_free the cb_data passed to it
*/
struct {
void ( * fn ) ( struct ctdb_client_control_state * ) ;
2007-09-26 08:25:32 +04:00
void * private_data ;
2010-05-20 09:48:30 +04:00
} async ;
2007-08-23 13:27:09 +04:00
} ;
2010-08-18 03:46:31 +04:00
struct tevent_context ;
2015-10-27 09:34:06 +03:00
struct ctdb_db_context ;
2006-11-18 02:41:20 +03:00
/*
2015-10-27 09:34:06 +03:00
allocate a packet for use in client < - > daemon communication
*/
struct ctdb_req_header * _ctdbd_allocate_pkt ( struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
enum ctdb_operation operation ,
size_t length , size_t slength ,
const char * type ) ;
2011-08-08 18:35:56 +04:00
2015-10-27 09:34:06 +03:00
# define ctdbd_allocate_pkt(ctdb, mem_ctx, operation, length, type) \
( type * ) _ctdbd_allocate_pkt ( ctdb , mem_ctx , operation , length , \
sizeof ( type ) , # type )
2007-04-03 13:41:00 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_call_local ( struct ctdb_db_context * ctdb_db , struct ctdb_call * call ,
struct ctdb_ltdb_header * header , TALLOC_CTX * mem_ctx ,
TDB_DATA * data , bool updatetdb ) ;
2006-11-18 02:41:20 +03:00
2015-10-27 09:34:06 +03:00
void ctdb_request_message ( struct ctdb_context * ctdb ,
struct ctdb_req_header * hdr ) ;
2006-11-18 02:41:20 +03:00
2015-10-27 09:34:06 +03:00
void ctdb_client_read_cb ( uint8_t * data , size_t cnt , void * args ) ;
2006-11-18 02:41:20 +03:00
2015-10-27 09:34:06 +03:00
int ctdb_socket_connect ( struct ctdb_context * ctdb ) ;
2006-11-18 02:41:20 +03:00
/*
make a ctdb call . The associated ctdb call function will be called on the DMASTER
for the given record
*/
2015-10-27 09:34:06 +03:00
struct ctdb_client_call_state * ctdb_call_send ( struct ctdb_db_context * ctdb_db ,
struct ctdb_call * call ) ;
int ctdb_call_recv ( struct ctdb_client_call_state * state ,
struct ctdb_call * call ) ;
2007-04-03 13:41:00 +04:00
int ctdb_call ( struct ctdb_db_context * ctdb_db , struct ctdb_call * call ) ;
2006-11-27 13:38:13 +03:00
2007-02-09 01:42:04 +03:00
/* setup a handler for ctdb messages */
2010-06-02 04:00:58 +04:00
typedef void ( * ctdb_msg_fn_t ) ( struct ctdb_context * , uint64_t srvid ,
2015-10-27 09:34:06 +03:00
TDB_DATA data , void * ) ;
2010-06-02 03:51:47 +04:00
int ctdb_client_set_message_handler ( struct ctdb_context * ctdb , uint64_t srvid ,
2015-04-08 07:38:26 +03:00
srvid_handler_fn handler ,
void * private_data ) ;
2010-06-02 04:05:58 +04:00
int ctdb_client_remove_message_handler ( struct ctdb_context * ctdb ,
uint64_t srvid , void * private_data ) ;
2013-08-23 10:51:26 +04:00
int ctdb_client_check_message_handlers ( struct ctdb_context * ctdb ,
uint64_t * ids , uint32_t num ,
uint8_t * result ) ;
2007-04-09 05:51:27 +04:00
2007-02-09 01:42:04 +03:00
/* send a ctdb message */
2010-06-02 03:45:21 +04:00
int ctdb_client_send_message ( struct ctdb_context * ctdb , uint32_t pnn ,
2015-10-27 09:34:06 +03:00
uint64_t srvid , TDB_DATA data ) ;
2007-04-04 15:15:56 +04:00
2010-05-20 09:48:30 +04:00
/*
2015-10-27 09:34:06 +03:00
Fetch a ctdb record from a remote node . Underneath this will force the
2010-05-20 09:48:30 +04:00
dmaster for the record to be moved to the local node .
2007-04-04 15:15:56 +04:00
*/
2015-10-27 09:34:06 +03:00
struct ctdb_record_handle * ctdb_fetch_lock ( struct ctdb_db_context * ctdb_db ,
TALLOC_CTX * mem_ctx ,
2007-04-17 08:52:51 +04:00
TDB_DATA key , TDB_DATA * data ) ;
2015-10-27 09:34:06 +03:00
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 ) ;
2011-07-20 09:37:37 +04:00
2007-04-17 08:52:51 +04:00
int ctdb_record_store ( struct ctdb_record_handle * h , TDB_DATA data ) ;
2007-04-04 15:15:56 +04:00
2010-05-20 09:48:30 +04:00
int ctdb_fetch ( struct ctdb_db_context * ctdb_db , TALLOC_CTX * mem_ctx ,
2007-08-15 03:03:58 +04:00
TDB_DATA key , TDB_DATA * data ) ;
2015-10-27 09:34:06 +03:00
struct ctdb_client_control_state * ctdb_control_send ( struct ctdb_context * ctdb ,
uint32_t destnode ,
uint64_t srvid ,
uint32_t opcode ,
uint32_t flags ,
TDB_DATA data ,
TALLOC_CTX * mem_ctx ,
struct timeval * timeout ,
char * * errormsg ) ;
int ctdb_control_recv ( struct ctdb_context * ctdb ,
struct ctdb_client_control_state * state ,
TALLOC_CTX * mem_ctx , TDB_DATA * outdata ,
int32_t * status , char * * errormsg ) ;
int ctdb_control ( struct ctdb_context * ctdb , uint32_t destnode , uint64_t srvid ,
uint32_t opcode , uint32_t flags , TDB_DATA data ,
TALLOC_CTX * mem_ctx , TDB_DATA * outdata , int32_t * status ,
struct timeval * timeout , char * * errormsg ) ;
2007-04-17 05:34:45 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_process_exists ( struct ctdb_context * ctdb , uint32_t destnode ,
pid_t pid ) ;
2007-04-26 16:27:49 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_statistics ( struct ctdb_context * ctdb , uint32_t destnode ,
struct ctdb_statistics * status ) ;
int ctdb_ctrl_dbstatistics ( struct ctdb_context * ctdb , uint32_t destnode ,
uint32_t dbid , TALLOC_CTX * mem_ctx ,
2015-10-29 09:33:09 +03:00
struct ctdb_db_statistics_old * * dbstat ) ;
2007-04-26 21:27:07 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_shutdown ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode ) ;
2013-05-21 10:18:28 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_getvnnmap ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , TALLOC_CTX * mem_ctx ,
struct ctdb_vnn_map * * vnnmap ) ;
int ctdb_ctrl_setvnnmap ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , TALLOC_CTX * mem_ctx ,
struct ctdb_vnn_map * vnnmap ) ;
2007-04-29 12:34:11 +04:00
2007-04-29 16:51:56 +04:00
/*
get the recovery mode of a remote node
*/
2015-10-27 09:34:06 +03:00
struct ctdb_client_control_state * ctdb_ctrl_getrecmode_send (
struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
struct timeval timeout ,
uint32_t destnode ) ;
int ctdb_ctrl_getrecmode_recv ( struct ctdb_context * ctdb , TALLOC_CTX * mem_ctx ,
struct ctdb_client_control_state * state ,
uint32_t * recmode ) ;
int ctdb_ctrl_getrecmode ( struct ctdb_context * ctdb , TALLOC_CTX * mem_ctx ,
struct timeval timeout , uint32_t destnode ,
uint32_t * recmode ) ;
2007-08-23 07:00:10 +04:00
2007-04-29 16:51:56 +04:00
/*
set the recovery mode of a remote node
*/
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_setrecmode ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , uint32_t recmode ) ;
2007-04-29 16:51:56 +04:00
2008-03-25 00:27:38 +03:00
/*
2015-10-27 09:34:06 +03:00
get the recovery master of a remote node
2008-03-25 00:27:38 +03:00
*/
2015-10-27 09:34:06 +03:00
struct ctdb_client_control_state * ctdb_ctrl_getrecmaster_send (
struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
struct timeval timeout ,
uint32_t destnode ) ;
int ctdb_ctrl_getrecmaster_recv ( struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
struct ctdb_client_control_state * state ,
uint32_t * recmaster ) ;
int ctdb_ctrl_getrecmaster ( struct ctdb_context * ctdb , TALLOC_CTX * mem_ctx ,
struct timeval timeout , uint32_t destnode ,
uint32_t * recmaster ) ;
2008-03-25 00:27:38 +03:00
/*
2015-10-27 09:34:06 +03:00
set the recovery master of a remote node
2008-03-25 00:27:38 +03:00
*/
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_setrecmaster ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , uint32_t recmaster ) ;
2008-03-25 00:27:38 +03:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_getdbmap ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , TALLOC_CTX * mem_ctx ,
2015-10-29 09:46:05 +03:00
struct ctdb_dbid_map_old * * dbmap ) ;
2007-08-23 13:27:09 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_getnodemap ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , TALLOC_CTX * mem_ctx ,
2015-10-29 09:22:48 +03:00
struct ctdb_node_map_old * * nodemap ) ;
2007-08-23 13:27:09 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_getnodesfile ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , TALLOC_CTX * mem_ctx ,
2015-10-29 09:22:48 +03:00
struct ctdb_node_map_old * * nodemap ) ;
2007-08-23 13:27:09 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_reload_nodes_file ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ) ;
2007-08-23 13:27:09 +04:00
2015-10-27 09:34:06 +03:00
struct ctdb_client_control_state * ctdb_ctrl_pulldb_send (
struct ctdb_context * ctdb ,
uint32_t destnode , uint32_t dbid ,
uint32_t lmaster , TALLOC_CTX * mem_ctx ,
struct timeval timeout ) ;
int ctdb_ctrl_pulldb_recv ( struct ctdb_context * ctdb , TALLOC_CTX * mem_ctx ,
struct ctdb_client_control_state * state ,
TDB_DATA * outdata ) ;
int ctdb_ctrl_pulldb ( struct ctdb_context * ctdb , uint32_t destnode ,
uint32_t dbid , uint32_t lmaster , TALLOC_CTX * mem_ctx ,
struct timeval timeout , TDB_DATA * outdata ) ;
2007-08-23 13:27:09 +04:00
2007-05-06 23:02:48 +04:00
/*
2015-10-27 09:34:06 +03:00
change dmaster for all keys in the database to the new value
2007-05-06 23:02:48 +04:00
*/
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_setdmaster ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , TALLOC_CTX * mem_ctx ,
uint32_t dbid , uint32_t dmaster ) ;
int ctdb_ctrl_ping ( struct ctdb_context * ctdb , uint32_t destnode ) ;
int ctdb_ctrl_get_runstate ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , uint32_t * runstate ) ;
int ctdb_ctrl_getdbpath ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , uint32_t dbid ,
TALLOC_CTX * mem_ctx , const char * * path ) ;
int ctdb_ctrl_getdbname ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , uint32_t dbid ,
TALLOC_CTX * mem_ctx , const char * * name ) ;
int ctdb_ctrl_getdbhealth ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , uint32_t dbid ,
TALLOC_CTX * mem_ctx , const char * * reason ) ;
int ctdb_ctrl_getdbseqnum ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , uint32_t dbid , uint64_t * seqnum ) ;
int ctdb_ctrl_createdb ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , TALLOC_CTX * mem_ctx ,
const char * name , bool persistent ) ;
int ctdb_ctrl_get_debuglevel ( struct ctdb_context * ctdb , uint32_t destnode ,
int32_t * level ) ;
int ctdb_ctrl_set_debuglevel ( struct ctdb_context * ctdb , uint32_t destnode ,
int32_t level ) ;
2007-05-06 23:02:48 +04:00
2010-05-20 09:48:30 +04:00
uint32_t * ctdb_get_connected_nodes ( struct ctdb_context * ctdb ,
struct timeval timeout ,
2015-10-27 09:34:06 +03:00
TALLOC_CTX * mem_ctx , uint32_t * num_nodes ) ;
2007-04-28 19:42:40 +04:00
2007-05-29 06:16:59 +04:00
int ctdb_statistics_reset ( struct ctdb_context * ctdb , uint32_t destnode ) ;
2007-04-28 21:13:36 +04:00
2015-10-27 09:34:06 +03:00
/*
attach to a ctdb database
*/
struct ctdb_db_context * ctdb_attach ( struct ctdb_context * ctdb ,
struct timeval timeout ,
const char * name ,
bool persistent ,
uint32_t tdb_flags ) ;
int ctdb_detach ( struct ctdb_context * ctdb , uint32_t db_id ) ;
/* a ctdb call function */
typedef int ( * ctdb_fn_t ) ( struct ctdb_call_info * ) ;
/*
setup a ctdb call function
*/
int ctdb_set_call ( struct ctdb_db_context * ctdb_db , ctdb_fn_t fn , uint32_t id ) ;
2015-04-08 07:24:31 +03:00
typedef int ( * ctdb_traverse_func ) ( TDB_DATA , TDB_DATA , void * ) ;
2015-10-27 09:34:06 +03:00
int ctdb_traverse ( struct ctdb_db_context * ctdb_db , ctdb_traverse_func fn ,
void * private_data ) ;
2007-05-04 06:18:39 +04:00
2011-11-28 20:11:16 +04:00
struct ctdb_dump_db_context {
2015-04-08 07:24:31 +03:00
struct ctdb_context * ctdb ;
2011-11-28 20:11:16 +04:00
FILE * f ;
bool printemptyrecords ;
2011-11-28 20:19:03 +04:00
bool printdatasize ;
2011-11-28 20:36:03 +04:00
bool printlmaster ;
2011-11-29 03:56:23 +04:00
bool printhash ;
2011-11-29 13:24:52 +04:00
bool printrecordflags ;
2011-11-28 20:11:16 +04:00
} ;
2015-04-08 07:24:31 +03:00
int ctdb_dumpdb_record ( TDB_DATA key , TDB_DATA data , void * p ) ;
2011-11-28 20:11:16 +04:00
int ctdb_dump_db ( struct ctdb_db_context * ctdb_db ,
struct ctdb_dump_db_context * ctx ) ;
2007-05-03 11:12:23 +04:00
2007-05-05 22:31:22 +04:00
/*
get the pid of a ctdb daemon
*/
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_getpid ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , uint32_t * pid ) ;
2010-05-20 09:48:30 +04:00
int ctdb_ctrl_freeze_priority ( struct ctdb_context * ctdb , struct timeval timeout ,
2009-10-12 02:22:17 +04:00
uint32_t destnode , uint32_t priority ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_freeze ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode ) ;
2007-08-27 04:31:22 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_getpnn ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode ) ;
2007-08-27 04:31:22 +04:00
2015-10-27 09:34:06 +03:00
/*
get the monitoring mode of a remote node
*/
int ctdb_ctrl_getmonmode ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , uint32_t * monmode ) ;
2007-05-12 09:15:27 +04:00
2015-10-27 09:34:06 +03:00
/*
set the monitoring mode of a remote node to active
*/
int ctdb_ctrl_enable_monmode ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ) ;
/*
set the monitoring mode of a remote node to disabled
*/
int ctdb_ctrl_disable_monmode ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ) ;
int ctdb_ctrl_takeover_ip ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , struct ctdb_public_ip * ip ) ;
int ctdb_ctrl_release_ip ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , struct ctdb_public_ip * ip ) ;
2007-05-23 08:35:19 +04:00
2010-05-20 09:48:30 +04:00
int ctdb_ctrl_get_tunable ( struct ctdb_context * ctdb ,
2015-10-27 09:34:06 +03:00
struct timeval timeout , uint32_t destnode ,
2007-06-04 13:53:19 +04:00
const char * name , uint32_t * value ) ;
2010-05-20 09:48:30 +04:00
int ctdb_ctrl_set_tunable ( struct ctdb_context * ctdb ,
2015-10-27 09:34:06 +03:00
struct timeval timeout , uint32_t destnode ,
2007-06-04 13:53:19 +04:00
const char * name , uint32_t value ) ;
2010-05-20 09:48:30 +04:00
int ctdb_ctrl_list_tunables ( struct ctdb_context * ctdb ,
2015-10-27 09:34:06 +03:00
struct timeval timeout , uint32_t destnode ,
2007-06-04 13:53:19 +04:00
TALLOC_CTX * mem_ctx ,
const char * * * list , uint32_t * count ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_get_public_ips_flags ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx , uint32_t flags ,
2015-10-28 09:16:24 +03:00
struct ctdb_public_ip_list_old * * ips ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_get_public_ips ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
2015-10-28 09:16:24 +03:00
struct ctdb_public_ip_list_old * * ips ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_get_public_ip_info ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
const ctdb_sock_addr * addr ,
2015-10-28 11:39:51 +03:00
struct ctdb_public_ip_info_old * * info ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_get_ifaces ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
2015-10-28 11:43:48 +03:00
struct ctdb_iface_list_old * * ifaces ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_set_iface_link ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
2015-10-28 11:37:17 +03:00
const struct ctdb_iface * info ) ;
2015-10-27 09:34:06 +03:00
2010-05-20 09:48:30 +04:00
int ctdb_ctrl_modflags ( struct ctdb_context * ctdb ,
struct timeval timeout ,
uint32_t destnode ,
2007-06-07 09:18:55 +04:00
uint32_t set , uint32_t clear ) ;
2007-06-04 13:53:19 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_get_all_tunables ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
2015-10-28 10:51:22 +03:00
struct ctdb_tunable_list * tunables ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_add_public_ip ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
2015-10-29 06:46:21 +03:00
struct ctdb_addr_info_old * pub ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_del_public_ip ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
2015-10-29 06:46:21 +03:00
struct ctdb_addr_info_old * pub ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_gratious_arp ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
ctdb_sock_addr * addr , const char * ifname ) ;
int ctdb_ctrl_get_tcp_tickles ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx , ctdb_sock_addr * addr ,
2015-10-28 10:44:19 +03:00
struct ctdb_tickle_list_old * * list ) ;
2015-10-27 09:34:06 +03:00
/*
initialise ctdb subsystem
*/
struct ctdb_context * ctdb_init ( struct tevent_context * ev ) ;
/*
set some flags
*/
void ctdb_set_flags ( struct ctdb_context * ctdb , unsigned flags ) ;
int ctdb_set_socketname ( struct ctdb_context * ctdb , const char * socketname ) ;
const char * ctdb_get_socketname ( struct ctdb_context * ctdb ) ;
/* return pnn of this node */
uint32_t ctdb_get_pnn ( struct ctdb_context * ctdb ) ;
2007-08-15 03:03:58 +04:00
2008-01-17 03:33:23 +03:00
/*
get the uptime of a remote node
*/
2015-10-27 09:34:06 +03:00
struct ctdb_client_control_state * ctdb_ctrl_uptime_send (
struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
struct timeval timeout ,
uint32_t destnode ) ;
int ctdb_ctrl_uptime_recv ( struct ctdb_context * ctdb , TALLOC_CTX * mem_ctx ,
struct ctdb_client_control_state * state ,
struct ctdb_uptime * * uptime ) ;
int ctdb_ctrl_uptime ( struct ctdb_context * ctdb , TALLOC_CTX * mem_ctx ,
struct timeval timeout , uint32_t destnode ,
struct ctdb_uptime * * uptime ) ;
int ctdb_ctrl_end_recovery ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode ) ;
typedef void ( * client_async_callback ) ( struct ctdb_context * ctdb ,
uint32_t node_pnn , int32_t res ,
TDB_DATA outdata , void * callback_data ) ;
struct client_async_data {
enum ctdb_controls opcode ;
bool dont_log_errors ;
uint32_t count ;
uint32_t fail_count ;
client_async_callback callback ;
client_async_callback fail_callback ;
void * callback_data ;
} ;
2008-01-17 03:33:23 +03:00
2015-10-27 09:34:06 +03:00
void ctdb_client_async_add ( struct client_async_data * data ,
struct ctdb_client_control_state * state ) ;
int ctdb_client_async_wait ( struct ctdb_context * ctdb ,
struct client_async_data * data ) ;
int ctdb_client_async_control ( struct ctdb_context * ctdb ,
enum ctdb_controls opcode , uint32_t * nodes ,
uint64_t srvid , struct timeval timeout ,
bool dont_log_errors , TDB_DATA data ,
client_async_callback client_callback ,
client_async_callback fail_callback ,
void * callback_data ) ;
2008-01-17 03:33:23 +03:00
2015-10-27 09:34:06 +03:00
uint32_t * list_of_vnnmap_nodes ( struct ctdb_context * ctdb ,
struct ctdb_vnn_map * vnn_map ,
TALLOC_CTX * mem_ctx , bool include_self ) ;
2008-01-17 03:33:23 +03:00
2015-10-27 09:34:06 +03:00
uint32_t * list_of_nodes ( struct ctdb_context * ctdb ,
2015-10-29 09:22:48 +03:00
struct ctdb_node_map_old * node_map ,
2015-10-27 09:34:06 +03:00
TALLOC_CTX * mem_ctx , uint32_t mask , int exclude_pnn ) ;
uint32_t * list_of_active_nodes ( struct ctdb_context * ctdb ,
2015-10-29 09:22:48 +03:00
struct ctdb_node_map_old * node_map ,
2015-10-27 09:34:06 +03:00
TALLOC_CTX * mem_ctx , bool include_self ) ;
uint32_t * list_of_connected_nodes ( struct ctdb_context * ctdb ,
2015-10-29 09:22:48 +03:00
struct ctdb_node_map_old * node_map ,
2015-10-27 09:34:06 +03:00
TALLOC_CTX * mem_ctx , bool include_self ) ;
2008-01-29 05:59:28 +03:00
2015-10-27 09:34:06 +03:00
int ctdb_read_pnn_lock ( int fd , int32_t pnn ) ;
/*
get capabilities of a remote node
*/
struct ctdb_client_control_state * ctdb_ctrl_getcapabilities_send (
struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
struct timeval timeout ,
uint32_t destnode ) ;
int ctdb_ctrl_getcapabilities_recv ( struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
struct ctdb_client_control_state * state ,
uint32_t * capabilities ) ;
int ctdb_ctrl_getcapabilities ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
uint32_t * capabilities ) ;
2008-02-29 02:03:39 +03:00
2014-07-31 09:06:19 +04:00
struct ctdb_node_capabilities {
bool retrieved ;
uint32_t capabilities ;
} ;
/* Retrieve capabilities for all connected nodes. The length of the
* returned array can be calculated using talloc_array_length ( ) . */
2015-10-27 09:34:06 +03:00
struct ctdb_node_capabilities * ctdb_get_capabilities (
struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
struct timeval timeout ,
2015-10-29 09:22:48 +03:00
struct ctdb_node_map_old * nodemap ) ;
2014-07-31 09:06:19 +04:00
/* Get capabilities for specified node, NULL if not found */
2015-10-27 09:34:06 +03:00
uint32_t * ctdb_get_node_capabilities ( struct ctdb_node_capabilities * caps ,
uint32_t pnn ) ;
2014-07-31 09:06:19 +04:00
/* True if the given node has all of the required capabilities */
bool ctdb_node_has_capabilities ( struct ctdb_node_capabilities * caps ,
2015-10-27 09:34:06 +03:00
uint32_t pnn , uint32_t capabilities_required ) ;
2008-11-19 06:43:46 +03:00
2008-02-29 04:37:42 +03:00
2015-10-27 09:34:06 +03:00
struct ctdb_transaction_handle * ctdb_transaction_start (
struct ctdb_db_context * ctdb_db ,
TALLOC_CTX * mem_ctx ) ;
2010-05-20 09:48:30 +04:00
int ctdb_transaction_fetch ( struct ctdb_transaction_handle * h ,
TALLOC_CTX * mem_ctx ,
2008-07-30 13:58:27 +04:00
TDB_DATA key , TDB_DATA * data ) ;
2010-05-20 09:48:30 +04:00
int ctdb_transaction_store ( struct ctdb_transaction_handle * h ,
2008-07-30 13:58:27 +04:00
TDB_DATA key , TDB_DATA data ) ;
int ctdb_transaction_commit ( struct ctdb_transaction_handle * h ) ;
2013-11-06 06:43:53 +04:00
int ctdb_transaction_cancel ( struct ctdb_transaction_handle * h ) ;
2008-07-30 13:58:27 +04:00
2008-09-09 07:44:46 +04:00
int ctdb_ctrl_recd_ping ( struct ctdb_context * ctdb ) ;
2010-05-20 09:48:30 +04:00
int ctdb_ctrl_getscriptstatus ( struct ctdb_context * ctdb ,
2015-10-27 09:34:06 +03:00
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
2015-10-28 08:54:10 +03:00
enum ctdb_event type ,
2015-10-28 12:02:45 +03:00
struct ctdb_script_list_old * * script_status ) ;
2011-07-20 06:06:37 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_report_recd_lock_latency ( struct ctdb_context * ctdb ,
struct timeval timeout , double latency ) ;
2011-09-01 05:08:18 +04:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_getreclock ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx , const char * * reclock ) ;
2015-10-27 07:34:30 +03:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_stop_node ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode ) ;
int ctdb_ctrl_continue_node ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode ) ;
2015-10-27 07:34:30 +03:00
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_setlmasterrole ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
uint32_t lmasterrole ) ;
int ctdb_ctrl_setrecmasterrole ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
uint32_t recmasterrole ) ;
int ctdb_ctrl_enablescript ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , const char * script ) ;
int ctdb_ctrl_disablescript ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , const char * script ) ;
int ctdb_ctrl_set_ban ( struct ctdb_context * ctdb , struct timeval timeout ,
2015-10-28 10:18:33 +03:00
uint32_t destnode , struct ctdb_ban_state * bantime ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_get_ban ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , TALLOC_CTX * mem_ctx ,
2015-10-28 10:18:33 +03:00
struct ctdb_ban_state * * bantime ) ;
2015-10-27 09:34:06 +03:00
int ctdb_ctrl_set_db_priority ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
struct ctdb_db_priority * db_prio ) ;
int ctdb_ctrl_get_db_priority ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
uint32_t db_id , uint32_t * priority ) ;
int ctdb_ctrl_getstathistory ( struct ctdb_context * ctdb ,
2015-10-27 07:34:30 +03:00
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
2015-10-28 12:09:40 +03:00
struct ctdb_statistics_list_old * * stats ) ;
2015-10-27 09:34:06 +03:00
struct ctdb_ltdb_header * ctdb_header_from_record_handle (
struct ctdb_record_handle * h ) ;
struct ctdb_client_control_state * 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 ) ;
int ctdb_ctrl_updaterecord_recv ( struct ctdb_context * ctdb ,
struct ctdb_client_control_state * state ) ;
int 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 ) ;
struct ctdb_client_control_state * ctdb_ctrl_set_db_readonly_send (
struct ctdb_context * ctdb ,
uint32_t destnode , uint32_t dbid ) ;
int ctdb_ctrl_set_db_readonly_recv ( struct ctdb_context * ctdb ,
struct ctdb_client_control_state * state ) ;
int ctdb_ctrl_set_db_readonly ( struct ctdb_context * ctdb , uint32_t destnode ,
uint32_t dbid ) ;
struct ctdb_client_control_state * ctdb_ctrl_set_db_sticky_send (
struct ctdb_context * ctdb ,
uint32_t destnode , uint32_t dbid ) ;
int ctdb_ctrl_set_db_sticky_recv ( struct ctdb_context * ctdb ,
struct ctdb_client_control_state * state ) ;
int ctdb_ctrl_set_db_sticky ( struct ctdb_context * ctdb , uint32_t destnode ,
uint32_t dbid ) ;
2015-10-27 07:34:30 +03:00
2010-05-20 09:48:30 +04:00
# endif /* _CTDB_CLIENT_H */