source: vendor/current/ctdb/common/common.h

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 4.7 KB
Line 
1/*
2 ctdb database library
3
4 Copyright (C) Amitay Isaacs 2015
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_COMMON_H__
21#define __CTDB_COMMON_H__
22
23/* From common/ctdb_io.c */
24
25int ctdb_queue_length(struct ctdb_queue *queue);
26
27int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length);
28
29int ctdb_queue_set_fd(struct ctdb_queue *queue, int fd);
30
31struct ctdb_queue *ctdb_queue_setup(struct ctdb_context *ctdb,
32 TALLOC_CTX *mem_ctx, int fd, int alignment,
33 ctdb_queue_cb_fn_t callback,
34 void *private_data, const char *fmt, ...)
35 PRINTF_ATTRIBUTE(7,8);
36
37/* From common/ctdb_ltdb.c */
38
39struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb,
40 const char *name);
41
42uint32_t ctdb_lmaster(struct ctdb_context *ctdb, const TDB_DATA *key);
43
44int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db,
45 TDB_DATA key, struct ctdb_ltdb_header *header,
46 TALLOC_CTX *mem_ctx, TDB_DATA *data);
47
48int ctdb_ltdb_fetch_with_header(struct ctdb_db_context *ctdb_db,
49 TDB_DATA key, struct ctdb_ltdb_header *header,
50 TALLOC_CTX *mem_ctx, TDB_DATA *data);
51
52int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
53 struct ctdb_ltdb_header *header, TDB_DATA data);
54
55int ctdb_ltdb_lock(struct ctdb_db_context *ctdb_db, TDB_DATA key);
56
57int ctdb_ltdb_unlock(struct ctdb_db_context *ctdb_db, TDB_DATA key);
58
59int ctdb_ltdb_delete(struct ctdb_db_context *ctdb_db, TDB_DATA key);
60
61int ctdb_trackingdb_add_pnn(struct ctdb_context *ctdb, TDB_DATA *data, uint32_t pnn);
62
63typedef void (*ctdb_trackingdb_cb)(struct ctdb_context *ctdb, uint32_t pnn,
64 void *private_data);
65
66void ctdb_trackingdb_traverse(struct ctdb_context *ctdb, TDB_DATA data,
67 ctdb_trackingdb_cb cb, void *private_data);
68
69int ctdb_null_func(struct ctdb_call_info *call);
70
71int ctdb_fetch_func(struct ctdb_call_info *call);
72
73int ctdb_fetch_with_header_func(struct ctdb_call_info *call);
74
75/* from common/ctdb_util.c */
76
77const char *ctdb_errstr(struct ctdb_context *ctdb);
78
79void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...);
80
81void ctdb_fatal(struct ctdb_context *ctdb, const char *msg);
82
83void ctdb_die(struct ctdb_context *ctdb, const char *msg);
84
85bool ctdb_set_helper(const char *type, char *helper, size_t size,
86 const char *envvar,
87 const char *dir, const char *file);
88
89void ctdb_external_trace(void);
90
91int ctdb_parse_address(TALLOC_CTX *mem_ctx, const char *str,
92 ctdb_sock_addr *address);
93
94bool ctdb_same_address(ctdb_sock_addr *a1, ctdb_sock_addr *a2);
95
96uint32_t ctdb_hash(const TDB_DATA *key);
97
98struct ctdb_rec_data_old *ctdb_marshall_record(TALLOC_CTX *mem_ctx,
99 uint32_t reqid,
100 TDB_DATA key,
101 struct ctdb_ltdb_header *header,
102 TDB_DATA data);
103
104struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx,
105 struct ctdb_marshall_buffer *m,
106 uint64_t db_id,
107 uint32_t reqid,
108 TDB_DATA key,
109 struct ctdb_ltdb_header *header,
110 TDB_DATA data);
111
112TDB_DATA ctdb_marshall_finish(struct ctdb_marshall_buffer *m);
113
114struct ctdb_rec_data_old *ctdb_marshall_loop_next(
115 struct ctdb_marshall_buffer *m,
116 struct ctdb_rec_data_old *r,
117 uint32_t *reqid,
118 struct ctdb_ltdb_header *header,
119 TDB_DATA *key, TDB_DATA *data);
120
121void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip);
122
123bool ctdb_same_ip(const ctdb_sock_addr *tip1, const ctdb_sock_addr *tip2);
124
125bool ctdb_same_sockaddr(const ctdb_sock_addr *ip1, const ctdb_sock_addr *ip2);
126
127char *ctdb_addr_to_str(ctdb_sock_addr *addr);
128
129unsigned ctdb_addr_to_port(ctdb_sock_addr *addr);
130
131struct ctdb_node_map_old *ctdb_read_nodes_file(TALLOC_CTX *mem_ctx,
132 const char *nlist);
133
134struct ctdb_node_map_old *ctdb_node_list_to_map(struct ctdb_node **nodes,
135 uint32_t num_nodes,
136 TALLOC_CTX *mem_ctx);
137
138const char *runstate_to_string(enum ctdb_runstate runstate);
139
140enum ctdb_runstate runstate_from_string(const char *label);
141
142void ctdb_set_runstate(struct ctdb_context *ctdb, enum ctdb_runstate runstate);
143
144uint32_t *ctdb_key_to_idkey(TALLOC_CTX *mem_ctx, TDB_DATA key);
145
146#endif /* __CTDB_COMMON_H__ */
Note: See TracBrowser for help on using the repository browser.