summaryrefslogtreecommitdiff
path: root/source4/cluster/ctdb/include
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-04-04 04:57:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:49:47 -0500
commita78be2150ba06738f4c7e85ca2980200d4a3c533 (patch)
treebc30c417b22a8cd51692635134f4c865a6023235 /source4/cluster/ctdb/include
parent690df3ccd98c586610cc5e528b05f7863b334a3c (diff)
downloadsamba-a78be2150ba06738f4c7e85ca2980200d4a3c533.tar.gz
samba-a78be2150ba06738f4c7e85ca2980200d4a3c533.tar.bz2
samba-a78be2150ba06738f4c7e85ca2980200d4a3c533.zip
r22070: merge in the changes from the bzr ctdb tree, and convert the brlock
ctdb backend to use the updated multi-database API (This used to be commit 44dcac9e4d81bfc078512248967b6240db9d1bd8)
Diffstat (limited to 'source4/cluster/ctdb/include')
-rw-r--r--source4/cluster/ctdb/include/ctdb.h20
-rw-r--r--source4/cluster/ctdb/include/ctdb_private.h19
2 files changed, 28 insertions, 11 deletions
diff --git a/source4/cluster/ctdb/include/ctdb.h b/source4/cluster/ctdb/include/ctdb.h
index efb12c5daa..c5b6dbc782 100644
--- a/source4/cluster/ctdb/include/ctdb.h
+++ b/source4/cluster/ctdb/include/ctdb.h
@@ -89,6 +89,17 @@ int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist);
int ctdb_start(struct ctdb_context *ctdb);
/*
+ attach to a ctdb database
+*/
+struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, int tdb_flags,
+ int open_flags, mode_t mode);
+
+/*
+ find an attached ctdb_db handle given a name
+ */
+struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, const char *name);
+
+/*
error string for last ctdb error
*/
const char *ctdb_errstr(struct ctdb_context *);
@@ -99,20 +110,15 @@ typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
/*
setup a ctdb call function
*/
-int ctdb_set_call(struct ctdb_context *ctdb, ctdb_fn_t fn, int id);
+int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, int id);
-/*
- attach to a ctdb database
-*/
-int ctdb_attach(struct ctdb_context *ctdb, const char *name, int tdb_flags,
- int open_flags, mode_t mode);
/*
make a ctdb call. The associated ctdb call function will be called on the DMASTER
for the given record
*/
-int ctdb_call(struct ctdb_context *ctdb, struct ctdb_call *call);
+int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
/*
wait for all nodes to be connected - useful for test code
diff --git a/source4/cluster/ctdb/include/ctdb_private.h b/source4/cluster/ctdb/include/ctdb_private.h
index c863781c50..1e2244ff7d 100644
--- a/source4/cluster/ctdb/include/ctdb_private.h
+++ b/source4/cluster/ctdb/include/ctdb_private.h
@@ -76,6 +76,7 @@ struct ctdb_upcalls {
void (*node_connected)(struct ctdb_node *);
};
+
/* main state of the ctdb daemon */
struct ctdb_context {
struct event_context *ev;
@@ -87,15 +88,23 @@ struct ctdb_context {
unsigned flags;
struct idr_context *idr;
struct ctdb_node **nodes; /* array of nodes in the cluster - indexed by vnn */
- struct ctdb_registered_call *calls; /* list of registered calls */
char *err_msg;
- struct tdb_wrap *ltdb;
const struct ctdb_methods *methods; /* transport methods */
const struct ctdb_upcalls *upcalls; /* transport upcalls */
void *private; /* private to transport */
unsigned max_lacount;
ctdb_message_fn_t message_handler;
void *message_private;
+ struct ctdb_db_context *db_list;
+};
+
+struct ctdb_db_context {
+ struct ctdb_db_context *next, *prev;
+ struct ctdb_context *ctdb;
+ uint32_t db_id;
+ const char *db_name;
+ struct tdb_wrap *ltdb;
+ struct ctdb_registered_call *calls; /* list of registered calls */
};
#define CTDB_NO_MEMORY(ctdb, p) do { if (!(p)) { \
@@ -157,6 +166,7 @@ struct ctdb_req_header {
struct ctdb_req_call {
struct ctdb_req_header hdr;
+ uint32_t db_id;
uint32_t callid;
uint32_t keylen;
uint32_t calldatalen;
@@ -184,6 +194,7 @@ struct ctdb_reply_redirect {
struct ctdb_req_dmaster {
struct ctdb_req_header hdr;
+ uint32_t db_id;
uint32_t dmaster;
uint32_t keylen;
uint32_t datalen;
@@ -220,9 +231,9 @@ void ctdb_reply_error(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
void ctdb_reply_redirect(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
uint32_t ctdb_lmaster(struct ctdb_context *ctdb, const TDB_DATA *key);
-int ctdb_ltdb_fetch(struct ctdb_context *ctdb,
+int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db,
TDB_DATA key, struct ctdb_ltdb_header *header, TDB_DATA *data);
-int ctdb_ltdb_store(struct ctdb_context *ctdb, TDB_DATA key,
+int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
struct ctdb_ltdb_header *header, TDB_DATA data);
void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);