summaryrefslogtreecommitdiff
path: root/source4/cluster/cluster.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-02-08 00:58:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:44:49 -0500
commit07478016d7354274cd53ff2b4ec1dda3f0f439d1 (patch)
treeae2e3fdfd7a12fab6fc4ca244bda786d7a5bd09b /source4/cluster/cluster.c
parentecf2c1effb778a95fd863a5e87ec7e378d228b57 (diff)
downloadsamba-07478016d7354274cd53ff2b4ec1dda3f0f439d1.tar.gz
samba-07478016d7354274cd53ff2b4ec1dda3f0f439d1.tar.bz2
samba-07478016d7354274cd53ff2b4ec1dda3f0f439d1.zip
r21230: added the hooks needed in the cluster layer and the messaging code for
handling messages to remote nodes. Implemented dummy functions in the 'local' cluster backend for the messaging hooks, and modified the messaging layer to check if the destination is remote and redirect messages via the cluster layer (This used to be commit 4474552e8fb73efebef32ad8480d7fe9a1e379ef)
Diffstat (limited to 'source4/cluster/cluster.c')
-rw-r--r--source4/cluster/cluster.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/source4/cluster/cluster.c b/source4/cluster/cluster.c
index 16de01de07..ea800d2f62 100644
--- a/source4/cluster/cluster.c
+++ b/source4/cluster/cluster.c
@@ -33,11 +33,11 @@ void cluster_set_ops(struct cluster_ops *new_ops)
}
/*
- not a nice abstraction :(
+ an ugly way of getting at the backend handle (eg. ctdb context) via the cluster API
*/
-void *cluster_private(void)
+void *cluster_backend_handle(void)
{
- return ops->private;
+ return ops->backend_handle(ops);
}
/* by default use the local ops */
@@ -46,8 +46,6 @@ static void cluster_init(void)
if (ops == NULL) cluster_local_init();
}
-
-
/*
server a server_id for the local node
*/
@@ -76,3 +74,24 @@ struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, const char *dbname, i
cluster_init();
return ops->cluster_tdb_tmp_open(ops, mem_ctx, dbname, flags);
}
+
+
+/*
+ register a callback function for a messaging endpoint
+*/
+NTSTATUS cluster_message_init(struct messaging_context *msg, struct server_id server,
+ void (*handler)(struct messaging_context *,
+ struct server_id, uint32_t, DATA_BLOB))
+{
+ cluster_init();
+ return ops->message_init(ops, msg, server, handler);
+}
+
+/*
+ send a message to another node in the cluster
+*/
+NTSTATUS cluster_message_send(struct server_id server, uint32_t msg_type, DATA_BLOB *data)
+{
+ cluster_init();
+ return ops->message_send(ops, server, msg_type, data);
+}