Re: [Openais] API inconsistency - evs callback functions

2009-07-01 Thread Steven Dake
patch attached to fix

regards
-steve
On Wed, 2009-07-01 at 14:01 +0200, Wojtek Meler wrote:
> I've noticed a little API inconsistency. Every corosync service defines 
> callbacks which receive handle obtained from initialize function as 
> first argument.
> EVS is different - callbacks don't get handles. Without them one is 
> forced to use global / thread variables to remember which handle is 
> passed to evs_dispatch.
> Is there any chance to fix API in near future?
> 
> Regards,
> Wojtek
> ___
> Openais mailing list
> Openais@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/openais
Index: test/evsverify.c
===
--- test/evsverify.c	(revision 2332)
+++ test/evsverify.c	(working copy)
@@ -55,6 +55,7 @@
 
 static int deliveries = 0;
 static void evs_deliver_fn (
+	hdb_handle_t handle,
 	unsigned int nodeid,
 	const void *m,
 	size_t msg_len)
@@ -81,9 +82,10 @@
 }
 
 static void evs_confchg_fn (
-	unsigned int *member_list, size_t member_list_entries,
-	unsigned int *left_list, size_t left_list_entries,
-	unsigned int *joined_list, size_t joined_list_entries)
+	hdb_handle_t handle,
+	const unsigned int *member_list, size_t member_list_entries,
+	const unsigned int *left_list, size_t left_list_entries,
+	const unsigned int *joined_list, size_t joined_list_entries)
 {
 	int i;
 
Index: test/evsbench.c
===
--- test/evsbench.c	(revision 2333)
+++ test/evsbench.c	(working copy)
@@ -69,6 +69,7 @@
 volatile static int alarm_notice = 0;
 
 static void evs_deliver_fn (
+	hdb_handle_t handle,
 	unsigned int nodeid,
 	const void *msg,
 	size_t msg_len)
@@ -76,6 +77,7 @@
 }
 
 static void evs_confchg_fn (
+	hdb_handle_t handle,
 	const unsigned int *member_list, size_t member_list_entries,
 	const unsigned int *left_list, size_t left_list_entries,
 	const unsigned int *joined_list, size_t joined_list_entries)
Index: test/testevs.c
===
--- test/testevs.c	(revision 2333)
+++ test/testevs.c	(working copy)
@@ -48,6 +48,7 @@
 
 static int deliveries = 0;
 static void evs_deliver_fn (
+	hdb_handle_t handle,
 	unsigned int nodeid,
 	const void *msg,
 	size_t msg_len)
@@ -59,6 +60,7 @@
 }
 
 static void evs_confchg_fn (
+	hdb_handle_t handle,
 	const unsigned int *member_list, size_t member_list_entries,
 	const unsigned int *left_list, size_t left_list_entries,
 	const unsigned int *joined_list, size_t joined_list_entries)
Index: include/corosync/evs.h
===
--- include/corosync/evs.h	(revision 2333)
+++ include/corosync/evs.h	(working copy)
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -67,11 +68,13 @@
 };
 
 typedef void (*evs_deliver_fn_t) (
+	hdb_handle_t handle, 
 	unsigned int nodeid,
 	const void *msg,
 	size_t msg_len);
 
 typedef void (*evs_confchg_fn_t) (
+	hdb_handle_t handle, 
 	const unsigned int *member_list, size_t member_list_entries,
 	const unsigned int *left_list, size_t left_list_entries,
 	const unsigned int *joined_list, size_t joined_list_entries);
Index: lib/evs.c
===
--- lib/evs.c	(revision 2332)
+++ lib/evs.c	(working copy)
@@ -279,6 +279,7 @@
 		case MESSAGE_RES_EVS_DELIVER_CALLBACK:
 			res_evs_deliver_callback = (struct res_evs_deliver_callback *)dispatch_data;
 			callbacks.evs_deliver_fn (
+handle,
 res_evs_deliver_callback->local_nodeid,
 &res_evs_deliver_callback->msg,
 res_evs_deliver_callback->msglen);
@@ -287,6 +288,7 @@
 		case MESSAGE_RES_EVS_CONFCHG_CALLBACK:
 			res_evs_confchg_callback = (struct res_evs_confchg_callback *)dispatch_data;
 			callbacks.evs_confchg_fn (
+handle,
 res_evs_confchg_callback->member_list,
 res_evs_confchg_callback->member_list_entries,
 res_evs_confchg_callback->left_list,
___
Openais mailing list
Openais@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/openais

Re: [Openais] API inconsistency - evs callback functions

2009-07-01 Thread Steven Dake
On Wed, 2009-07-01 at 14:52 +0200, Wojtek Meler wrote:
> Wojtek Meler pisze:
> > I've noticed a little API inconsistency. Every corosync service defines 
> > callbacks which receive handle obtained from initialize function as 
> > first argument.
> > EVS is different - callbacks don't get handles. Without them one is 
> > forced to use global / thread variables to remember which handle is 
> > passed to evs_dispatch.
> > Is there any chance to fix API in near future?
> >
> >   
> Deliver callback doesn't have group name too :(. There is no way to 
> discover it
> I'm quite confused. How cpg differ from evs?  How should I decide which 
> service I should use?
> 

EVS is used for virtual synchrony passthrough.  It has the concept of
groups only so multiple applications can use EVS.  Generally unless you
are creating an application that requires EVS details, you will want to
use CPG.

CPG provides a lightweight closed process group membership layer ontop
of the membership layer provided by totem.  I recommend CPG for all
development related to clustering since it provides a better membership
model.

Regards
-steve

> Regards,
> Wojtek
> ___
> Openais mailing list
> Openais@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/openais

___
Openais mailing list
Openais@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/openais


Re: [Openais] API inconsistency - evs callback functions

2009-07-01 Thread David Teigland
On Wed, Jul 01, 2009 at 02:01:14PM +0200, Wojtek Meler wrote:
> I've noticed a little API inconsistency. Every corosync service defines 
> callbacks which receive handle obtained from initialize function as 
> first argument.
> EVS is different - callbacks don't get handles. Without them one is 
> forced to use global / thread variables to remember which handle is 
> passed to evs_dispatch.
> Is there any chance to fix API in near future?

I wonder if evs is even used by anything/anyone?  I don't know the history of
how/why it came to exist.  When I first investigated openais years ago, I
looked at the evs service, hoping I could use it, but quickly found it
wouldn't do, so I outlined specifically what I needed and that became cpg.

Dave

___
Openais mailing list
Openais@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/openais


Re: [Openais] API inconsistency - evs callback functions

2009-07-01 Thread Wojtek Meler
Wojtek Meler pisze:
> I've noticed a little API inconsistency. Every corosync service defines 
> callbacks which receive handle obtained from initialize function as 
> first argument.
> EVS is different - callbacks don't get handles. Without them one is 
> forced to use global / thread variables to remember which handle is 
> passed to evs_dispatch.
> Is there any chance to fix API in near future?
>
>   
Deliver callback doesn't have group name too :(. There is no way to 
discover it
I'm quite confused. How cpg differ from evs?  How should I decide which 
service I should use?

Regards,
Wojtek
___
Openais mailing list
Openais@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/openais