⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ctdb_private.h

📁 samba最新软件
💻 H
📖 第 1 页 / 共 3 页
字号:
/*    ctdb database library   Copyright (C) Andrew Tridgell  2006   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   the Free Software Foundation; either version 3 of the License, or   (at your option) any later version.      This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.      You should have received a copy of the GNU General Public License   along with this program; if not, see <http://www.gnu.org/licenses/>.*/#ifndef _CTDB_PRIVATE_H#define _CTDB_PRIVATE_H#include "ctdb.h"#include <sys/socket.h>#include <netinet/in.h>/* location of daemon socket */#define CTDB_PATH	"/tmp/ctdb.socket"/* default ctdb port number */#define CTDB_PORT 4379/* we must align packets to ensure ctdb works on all architectures (eg. sparc) */#define CTDB_DS_ALIGNMENT 8#define CTDB_NULL_FUNC      0xFF000001#define CTDB_FETCH_FUNC     0xFF000002/*  a tcp connection description */struct ctdb_tcp_connection {	struct sockaddr_in saddr;	struct sockaddr_in daddr;};/* the wire representation for a tcp tickle array */struct ctdb_tcp_wire_array {	uint32_t num;	struct ctdb_tcp_connection connections[1];};	/* the list of tcp tickles used by get/set tcp tickle list */struct ctdb_control_tcp_tickle_list {	uint32_t vnn;	struct ctdb_tcp_wire_array tickles;};/*  array of tcp connections */struct ctdb_tcp_array {	uint32_t num;	struct ctdb_tcp_connection *connections;};	/* all tunable variables go in here */struct ctdb_tunable {	uint32_t max_redirect_count;	uint32_t seqnum_frequency;	uint32_t control_timeout;	uint32_t traverse_timeout;	uint32_t keepalive_interval;	uint32_t keepalive_limit;	uint32_t max_lacount;	uint32_t recover_timeout;	uint32_t recover_interval;	uint32_t election_timeout;	uint32_t takeover_timeout;	uint32_t monitor_interval;	uint32_t tickle_update_interval;	uint32_t script_timeout;	uint32_t recovery_grace_period;	uint32_t recovery_ban_period;	uint32_t database_hash_size;	uint32_t rerecovery_timeout;};/*  an installed ctdb remote call*/struct ctdb_registered_call {	struct ctdb_registered_call *next, *prev;	uint32_t id;	ctdb_fn_t fn;};/*  this address structure might need to be generalised later for some  transports*/struct ctdb_address {	const char *address;	int port;};/*  check a vnn is valid */#define ctdb_validate_vnn(ctdb, vnn) (((uint32_t)(vnn)) < (ctdb)->num_nodes)/* called from the queue code when a packet comes in. Called with data==NULL   on error */typedef void (*ctdb_queue_cb_fn_t)(uint8_t *data, size_t length,				   void *private_data);/* used for callbacks in ctdb_control requests */typedef void (*ctdb_control_callback_fn_t)(struct ctdb_context *,					   int32_t status, TDB_DATA data, 					   const char *errormsg,					   void *private_data);/*  structure describing a connected client in the daemon */struct ctdb_client {	struct ctdb_context *ctdb;	int fd;	struct ctdb_queue *queue;	uint32_t client_id;	pid_t pid;	struct ctdb_tcp_list *tcp_list;};/*  state associated with one node*/struct ctdb_node {	struct ctdb_context *ctdb;	struct ctdb_address address;	const char *name; /* for debug messages */	void *private_data; /* private to transport */	uint32_t vnn;#define NODE_FLAGS_DISCONNECTED		0x00000001 /* node isn't connected */#define NODE_FLAGS_UNHEALTHY  		0x00000002 /* monitoring says node is unhealthy */#define NODE_FLAGS_PERMANENTLY_DISABLED	0x00000004 /* administrator has disabled node */#define NODE_FLAGS_BANNED		0x00000008 /* recovery daemon has banned the node */#define NODE_FLAGS_DISABLED		(NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED)#define NODE_FLAGS_INACTIVE		(NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED)	uint32_t flags;	/* used by the dead node monitoring */	uint32_t dead_count;	uint32_t rx_cnt;	uint32_t tx_cnt;	/* a list of controls pending to this node, so we can time them out quickly	   if the node becomes disconnected */	struct daemon_control_state *pending_controls;	/* the public address of this node, if known */	const char *public_address;	uint8_t public_netmask_bits;	/* the node number that has taken over this nodes public address, if any. 	   If not taken over, then set to -1 */	int32_t takeover_vnn;	/* List of clients to tickle for this public address */	struct ctdb_tcp_array *tcp_array;	/* whether we need to update the other nodes with changes to our list	   of connected clients */	bool tcp_update_needed;};/*  transport specific methods*/struct ctdb_methods {	int (*initialise)(struct ctdb_context *); /* initialise transport structures */		int (*start)(struct ctdb_context *); /* start protocol processing */		int (*add_node)(struct ctdb_node *); /* setup a new node */		int (*queue_pkt)(struct ctdb_node *, uint8_t *data, uint32_t length);	void *(*allocate_pkt)(TALLOC_CTX *mem_ctx, size_t );	void (*shutdown)(struct ctdb_context *); /* shutdown transport */};/*  transport calls up to the ctdb layer*/struct ctdb_upcalls {	/* recv_pkt is called when a packet comes in */	void (*recv_pkt)(struct ctdb_context *, uint8_t *data, uint32_t length);	/* node_dead is called when an attempt to send to a node fails */	void (*node_dead)(struct ctdb_node *);	/* node_connected is called when a connection to a node is established */	void (*node_connected)(struct ctdb_node *);};/* list of message handlers - needs to be changed to a more efficient data   structure so we can find a message handler given a srvid quickly */struct ctdb_message_list {	struct ctdb_context *ctdb;	struct ctdb_message_list *next, *prev;	uint64_t srvid;	ctdb_message_fn_t message_handler;	void *message_private;};/* additional data required for the daemon mode */struct ctdb_daemon_data {	int sd;	char *name;	struct ctdb_queue *queue;};/*  ctdb status information */struct ctdb_statistics {	uint32_t num_clients;	uint32_t frozen;	uint32_t recovering;	uint32_t client_packets_sent;	uint32_t client_packets_recv;	uint32_t node_packets_sent;	uint32_t node_packets_recv;	uint32_t keepalive_packets_sent;	uint32_t keepalive_packets_recv;	struct {		uint32_t req_call;		uint32_t reply_call;		uint32_t req_dmaster;		uint32_t reply_dmaster;		uint32_t reply_error;		uint32_t req_message;		uint32_t req_control;		uint32_t reply_control;	} node;	struct {		uint32_t req_call;		uint32_t req_message;		uint32_t req_control;	} client;	struct {		uint32_t call;		uint32_t control;		uint32_t traverse;	} timeouts;	uint32_t total_calls;	uint32_t pending_calls;	uint32_t lockwait_calls;	uint32_t pending_lockwait_calls;	uint32_t memory_used;	uint32_t __last_counter; /* hack for control_statistics_all */	uint32_t max_hop_count;	double max_call_latency;	double max_lockwait_latency;};/* table that contains the mapping between a hash value and lmaster */struct ctdb_vnn_map {	uint32_t generation;	uint32_t size;	uint32_t *map;};/*    a wire representation of the vnn map */struct ctdb_vnn_map_wire {	uint32_t generation;	uint32_t size;	uint32_t map[1];};/* a structure that contains the elements required for the write record   control*/struct ctdb_write_record {	uint32_t dbid;	uint32_t keylen;	uint32_t datalen;	unsigned char blob[1];};enum ctdb_freeze_mode {CTDB_FREEZE_NONE, CTDB_FREEZE_PENDING, CTDB_FREEZE_FROZEN};#define CTDB_MONITORING_ACTIVE		0#define CTDB_MONITORING_DISABLED	1/* information about IP takeover */struct ctdb_takeover {	bool enabled;	const char *interface;	const char *event_script;	TALLOC_CTX *last_ctx;};/* main state of the ctdb daemon */struct ctdb_context {	struct event_context *ev;	uint32_t recovery_mode;	uint32_t monitoring_mode;	TALLOC_CTX *monitor_context;	TALLOC_CTX *tickle_update_context;	struct ctdb_tunable tunable;	enum ctdb_freeze_mode freeze_mode;	struct ctdb_freeze_handle *freeze_handle;	struct ctdb_address address;	const char *name;	const char *db_directory;	const char *transport;	const char *logfile;	char *node_list_file;	char *recovery_lock_file;	int recovery_lock_fd;	uint32_t vnn; /* our own vnn */	uint32_t num_nodes;	uint32_t num_connected;	unsigned flags;	struct idr_context *idr;	uint16_t idr_cnt;	struct ctdb_node **nodes; /* array of nodes in the cluster - indexed by vnn */	char *err_msg;	const struct ctdb_methods *methods; /* transport methods */	const struct ctdb_upcalls *upcalls; /* transport upcalls */	void *private_data; /* private to transport */	struct ctdb_db_context *db_list;	struct ctdb_message_list *message_list;	struct ctdb_daemon_data daemon;	struct ctdb_statistics statistics;	struct ctdb_vnn_map *vnn_map;	uint32_t num_clients;	uint32_t recovery_master;	struct ctdb_call_state *pending_calls;	struct ctdb_takeover takeover;	struct ctdb_client_ip *client_ip_list;	bool do_setsched;	void *saved_scheduler_param;	struct ctdb_kill_tcp *killtcp;};struct ctdb_db_context {	struct ctdb_db_context *next, *prev;	struct ctdb_context *ctdb;	uint32_t db_id;	const char *db_name;	const char *db_path;	struct tdb_wrap *ltdb;	struct ctdb_registered_call *calls; /* list of registered calls */	uint32_t seqnum;	struct timed_event *te;};#define CTDB_NO_MEMORY(ctdb, p) do { if (!(p)) { \          DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \          ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); \	  return -1; }} while (0)#define CTDB_NO_MEMORY_VOID(ctdb, p) do { if (!(p)) { \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -