Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
heartbeat.h
Go to the documentation of this file.
1 /* -*- mode: c; c-basic-offset: 8; -*-
2  * vim: noexpandtab sw=8 ts=8 sts=0:
3  *
4  * heartbeat.h
5  *
6  * Function prototypes
7  *
8  * Copyright (C) 2004 Oracle. All rights reserved.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public
21  * License along with this program; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 021110-1307, USA.
24  *
25  */
26 
27 #ifndef R2CLUSTER_HEARTBEAT_H
28 #define R2CLUSTER_HEARTBEAT_H
29 
30 #define R2HB_REGION_TIMEOUT_MS 2000
31 
32 #define R2HB_MAX_REGION_NAME_LEN 32
33 
34 /* number of changes to be seen as live */
35 #define R2HB_LIVE_THRESHOLD 2
36 /* number of equal samples to be seen as dead */
37 extern unsigned int r2hb_dead_threshold;
38 #define R2HB_DEFAULT_DEAD_THRESHOLD 31
39 /* Otherwise MAX_WRITE_TIMEOUT will be zero... */
40 #define R2HB_MIN_DEAD_THRESHOLD 2
41 #define R2HB_MAX_WRITE_TIMEOUT_MS \
42  (R2HB_REGION_TIMEOUT_MS * (r2hb_dead_threshold - 1))
43 
44 #define R2HB_CB_MAGIC 0x51d1e4ec
45 
46 /* callback stuff */
51 };
52 
53 struct r2nm_node;
54 typedef void (r2hb_cb_func)(struct r2nm_node *, int, void *);
55 
60  void *hc_data;
63 };
64 
65 struct config_group *r2hb_alloc_hb_set(void);
66 void r2hb_free_hb_set(struct config_group *group);
67 
71  void *data,
72  int priority);
73 int r2hb_register_callback(const char *region_uuid,
74  struct r2hb_callback_func *hc);
75 void r2hb_unregister_callback(const char *region_uuid,
76  struct r2hb_callback_func *hc);
77 void r2hb_fill_node_map(unsigned long *map,
78  unsigned bytes);
79 void r2hb_exit(void);
80 int r2hb_init(void);
82 void r2hb_stop_all_regions(void);
83 int r2hb_get_all_regions(char *region_uuids, u8 numregions);
86 
87 #endif /* R2CLUSTER_HEARTBEAT_H */