[PATCH][mama] Added a heartbeat tick API for building FT recovery functionality


Ian Bell <IBell@...>
 

commit f9f47ce5c1a28f52470b056c852722bd85dadde9

Author: Ian Bell <IBell@...>

Date:   Thu May 17 21:43:16 2012 +0100

 

    [mama] Added a heartbeat tick API for building FT recovery functionality

    Signed-off-by: Ian Bell <IBell@...>

 

diff --git a/mama/c_cpp/src/c/ft.c b/mama/c_cpp/src/c/ft.c

index a6b886c..b7366d3 100644

--- a/mama/c_cpp/src/c/ft.c

+++ b/mama/c_cpp/src/c/ft.c

@@ -142,6 +142,7 @@ typedef struct mamaFtMemberImpl_

     mamaPublisher                  myPublisher;

     mamaTimer                      myHeartbeatTimer;

     mamaTimer                      myTimeoutTimer;

+    mama_u32_t                     myHeartbeatTick;

     mamaMsg                        myHeartbeatMsg;

     const char*                    myInstanceId;

     const char*                    mySymbol;

@@ -298,6 +299,7 @@ mamaFtMember_activate (

     mama_getIpAddress(&ipaddress);

     impl->myIP=inet_addr(ipaddress);

     impl->myNextIncarnation = 1;

+    impl->myHeartbeatTick = 0;

     /* Set up the heartbeat timeout timer. */

     status = startTimeoutTimer (impl);

@@ -408,6 +410,18 @@ mamaFtMember_getTimeoutInterval (

}

 mama_status

+mamaFtMember_getHeartbeatTick (

+    const mamaFtMember  member,

+    mama_u32_t*         result)

+{

+    mamaFtMemberImpl* impl = (mamaFtMemberImpl*) member;

+    if (!impl || !result)

+        return MAMA_STATUS_INVALID_ARG;

+    *result = impl->myHeartbeatTick;

+    return MAMA_STATUS_OK;

+}

+

+mama_status

mamaFtMember_getClosure (

     const mamaFtMember  member,

     void**              result)

@@ -611,6 +625,7 @@ ftHeartbeatTimerCb (mamaTimer          timer,

{

     mamaFtMemberImpl* impl = (mamaFtMemberImpl*)closure;

     mama_log (MAMA_LOG_LEVEL_FINE, "MAMA multicast FT: heartbeat timer has fired");

+    impl->myHeartbeatTick++;

     impl->ftSendHeartbeat (impl);

}

@@ -833,6 +848,7 @@ multicastFt_setup (

         if (ftInterface == NULL)

             ftInterface = "";

     }

+   

     ftNetwork = multicastFt_getProperty (propertyName,

             "mama.multicast.transport.%s.network", transportName);

     if (ftNetwork == NULL)

diff --git a/mama/c_cpp/src/c/mama/ft.h b/mama/c_cpp/src/c/mama/ft.h

index 2a96db4..b5279d3 100644

--- a/mama/c_cpp/src/c/mama/ft.h

+++ b/mama/c_cpp/src/c/mama/ft.h

@@ -156,6 +156,15 @@ mamaFtMember_getTimeoutInterval (

     mama_f64_t*         result);

 /**

+ * Get the current heartbeat tick of the MAMA FT member.

+ */

+MAMAExpDLL

+extern mama_status

+mamaFtMember_getHeartbeatTick (

+    const mamaFtMember  member,

+    mama_u32_t*         result);

+

+/**

  * Get the closure argument (provided in the mamaFtMember_create()

  * function) of the MAMA FT member.

  */



Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.